Back to index

moin  1.9.0~rc2
Public Member Functions | Package Attributes | Private Member Functions | Private Attributes
CH.ifa.draw.contrib.PolygonTool Class Reference
Collaboration diagram for CH.ifa.draw.contrib.PolygonTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PolygonTool (DrawingView view)
void activate ()
void deactivate ()
void mouseDown (MouseEvent e, int x, int y)
void keyDown (KeyEvent e, int key)
void mouseMove (MouseEvent e, int x, int y)
void mouseDrag (MouseEvent e, int x, int y)
void mouseUp (MouseEvent e, int x, int y)

Package Attributes

int fLastY

Private Member Functions

void addPoint (int x, int y)

Private Attributes

PolygonFigure fPolygon
int fLastX

Detailed Description

Definition at line 20 of file PolygonTool.java.


Constructor & Destructor Documentation

CH.ifa.draw.contrib.PolygonTool.PolygonTool ( DrawingView  view) [inline]

Definition at line 25 of file PolygonTool.java.

                                       {
    super(view);
  }

Member Function Documentation

Definition at line 29 of file PolygonTool.java.

                         {
    super.activate();
    fPolygon = null;
  }
void CH.ifa.draw.contrib.PolygonTool.addPoint ( int  x,
int  y 
) [inline, private]

Definition at line 45 of file PolygonTool.java.

                                      {
      if (fPolygon == null) {
          fPolygon = new PolygonFigure(x, y);
          view().add(fPolygon);
          fPolygon.addPoint(x, y);
      } else if (fLastX != x || fLastY != y)
          fPolygon.addPoint(x, y);

      fLastX = x;
      fLastY = y;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 34 of file PolygonTool.java.

                           {
    super.deactivate();
    if (fPolygon != null) {
      fPolygon.smoothPoints();
      if (fPolygon.pointCount() < 3 ||
          fPolygon.size().width < 4 || fPolygon.size().height < 4)
        drawing().remove(fPolygon);
    }
    fPolygon = null;
  }

Here is the call graph for this function:

void CH.ifa.draw.contrib.PolygonTool.keyDown ( KeyEvent  e,
int  key 
) [inline]

Definition at line 77 of file PolygonTool.java.

                                             {
       System.out.println("Key " + key);
       if (key == 27) {
           if (fPolygon != null) {
              fPolygon.smoothPoints();
              editor().toolDone();
           }
           fPolygon = null;
       }
    }

Here is the call graph for this function:

void CH.ifa.draw.contrib.PolygonTool.mouseDown ( MouseEvent  e,
int  x,
int  y 
) [inline]

Definition at line 57 of file PolygonTool.java.

                                                    {
    // replace pts by actual event pts
    x = e.getX();
    y = e.getY();

    if (e.getClickCount() >= 2) {
        if (fPolygon != null) {
            fPolygon.smoothPoints();
            editor().toolDone();
        }
        fPolygon = null;

    } else {
        // use original event coordinates to avoid
        // supress that the scribble is constrained to
        // the grid
        addPoint(e.getX(), e.getY());
    }
  }

Here is the call graph for this function:

void CH.ifa.draw.contrib.PolygonTool.mouseDrag ( MouseEvent  e,
int  x,
int  y 
) [inline]

Definition at line 97 of file PolygonTool.java.

                                                    {
    // replace pts by actual event pts
    x = e.getX();
    y = e.getY();
    addPoint(x, y);
  }

Here is the call graph for this function:

void CH.ifa.draw.contrib.PolygonTool.mouseMove ( MouseEvent  e,
int  x,
int  y 
) [inline]

Definition at line 88 of file PolygonTool.java.

                                                    {
    if (fPolygon != null) {
       if (fPolygon.pointCount() > 1) {
           fPolygon.setPointAt(new Point(x, y), fPolygon.pointCount()-1);
           view().checkDamage();
       }
    }
  }

Here is the call graph for this function:

void CH.ifa.draw.contrib.PolygonTool.mouseUp ( MouseEvent  e,
int  x,
int  y 
) [inline]

Definition at line 105 of file PolygonTool.java.

                                                  {
  }

Member Data Documentation

Definition at line 23 of file PolygonTool.java.

Definition at line 23 of file PolygonTool.java.

Definition at line 22 of file PolygonTool.java.


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