## devisor2.foundation
Class GridItem

    java.lang.Object
      devisor2.foundation.GridItem

Direct Known Subclasses:
  Cell, Edge, Node, Segment

public abstract class GridItem
extends java.lang.Object

This is the abstract superclass for EVERYTHING that can be displayed, modified or messed with on the DrawingArea. It provides abstract method definitions which are common to all grid items: All grid items must be able to draw themselves, perform an affine transformation on themselves, they must calculate their own perimeter etc etc.

Field Summary
`protected ControlCenter` `cc` the all-important ControlCenter reference
`protected boolean` `marked` flag to indicate if the item is currently selected
`protected boolean` `transformed` flag to indicate that in the currect transform step, this item has already been performed.
`protected int` `xmax` for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the `updateInnerData()<\code> method`
`protected int` `xmin` for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the `updateInnerData()<\code> method`
`protected int` `ymax` for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the `updateInnerData()<\code> method`
`protected int` `ymin` for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the `updateInnerData()<\code> method`

Constructor Summary
`GridItem()` superconstructor just sets references correctly

Method Summary
`void` `clearTransformedFlag()` clears the "a transformation has already been performed"-flag
`abstract void` `draw(java.awt.Graphics g)` in this method, the item paints itself to the given graphics context
`abstract double[]` `getParameters()` returns all parameters of the griditem in an int array
`abstract java.awt.Rectangle` `getPerimeter()` This method returns the perimeter of the item, that is the smallest bounding rectangle the item lies is completely inside of.
`abstract boolean` `isHit(int x, int y)` Determines if the item has been hit by a click on the grid ALL IN SCREEN COORDINATES to avoid the snap mechanism
`abstract boolean` `isInside(int[] topleft, int[] bottomright)` Is the item inside a given rectangular area? All in WORLD COORDINATES!!!
`boolean` `isMarked()` returns if the item is selected
`abstract void` `performMirror(double nx, double ny, double px, double py)` This method mirrors the grid item at the given line
`abstract void` `performTransformation(GridTransformation trafo)` This method performs the given affine transformation (in homogenous world coordinates) on the grid item and updates its position and appearance
`void` `setMarker()` marks the item as selected
`void` `setMarker(boolean m)` sets the marker variable directly
`abstract void` `setParameters(double[] para)` sets all parameters of the GridItem according to the given int array
`void` `unsetMarker()` marks the item as unselected

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### cc

    protected ControlCenter cc

  the all-important ControlCenter reference

### marked

    protected boolean marked

  flag to indicate if the item is currently selected

### transformed

    protected boolean transformed

  flag to indicate that in the currect transform step, this item has already been performed.

### xmin

    protected int xmin

  for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the `updateInnerData()<\code> method

  `

### xmax

    protected int xmax

  for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the `updateInnerData()<\code> method

  `

### ymin

    protected int ymin

  for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the `updateInnerData()<\code> method

  `

### ymax

    protected int ymax

  for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the `updateInnerData()<\code> method

  `

Constructor Detail

### GridItem

    public GridItem()

  superconstructor just sets references correctly

Method Detail

### clearTransformedFlag

    public void clearTransformedFlag()

  clears the "a transformation has already been performed"-flag

### setMarker

    public void setMarker()

  marks the item as selected

### unsetMarker

    public void unsetMarker()

  marks the item as unselected

### isMarked

    public boolean isMarked()

  returns if the item is selected

### setMarker

    public void setMarker(boolean m)

  sets the marker variable directly

### draw

    public abstract void draw(java.awt.Graphics g)

  in this method, the item paints itself to the given graphics context

### isInside

    public abstract boolean isInside(int[] topleft,
                                     int[] bottomright)

  Is the item inside a given rectangular area? All in WORLD COORDINATES!!!

  Parameters:
    `topleft` - - the topleft corner of the rectangle
    `bottomright` - - the bottom right corner of the rectangle
  Returns:
    true if the item is completely inside the rectangle

### isHit

    public abstract boolean isHit(int x,
                                  int y)

  Determines if the item has been hit by a click on the grid ALL IN SCREEN COORDINATES to avoid the snap mechanism

  Returns:
    true if the item has been hit

### getParameters

    public abstract double[] getParameters()

  returns all parameters of the griditem in an int array

### setParameters

    public abstract void setParameters(double[] para)

  sets all parameters of the GridItem according to the given int array

### getPerimeter

    public abstract java.awt.Rectangle getPerimeter()

  This method returns the perimeter of the item, that is the smallest bounding rectangle the item lies is completely inside of.

  Returns:
    a Rectangle object defining the perimeter

### performTransformation

    public abstract void performTransformation(GridTransformation trafo)

  This method performs the given affine transformation (in homogenous world coordinates) on the grid item and updates its position and appearance

  Parameters:
    `trafo` - - a GridTransform instance representing the transformation

### performMirror

    public abstract void performMirror(double nx,
                                       double ny,
                                       double px,
                                       double py)

  This method mirrors the grid item at the given line