All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class element.GenericShape

java.lang.Object
   |
   +----java.awt.Component
           |
           +----element.GenericShape

public abstract class GenericShape
extends Component
This class implements the shape general functionality


Variable Index

 o ABOVE
the description text is drawn above this shape
 o alignment
alignment of the description text associated with this shape
 o BELOW
the description text is drawn below this shape
 o CENTER
center alignment of the description text
 o DASHED
dashed line style
 o DASHSIZE
dashed line segment length
 o direction
shape's drawing direction.
 o DOTTED
dotted line style
 o hasText
set to true iff this shape has a description text
 o INVISIBLE
invisible line style
 o lineStyle
drawing style (solid/dashed/dotted/invisible)
 o LJUST
left alignment of the description text
 o MINHEIGHT
 o MINWIDTH
 o RJUST
right alignment of the description text
 o shapeX
shape's X coordinate on the screen
 o shapeY
shape's Y coordinate on the screen
 o SOLID
solid line style
 o SPECIAL
the description text has a special alignment not supported by the application
 o text
description text associated with this shape

Constructor Index

 o GenericShape()
Constructs the shape and initializes its coordinates with global ones.

Method Index

 o alignmentToString(int)
Returns the shape description text's alignment as string
 o atPositionAsString()
Returns the shape's position as a pic text
 o center(int[])
Returns the most left and most rigth points for this shape.
 o clearElement(Graphics)
Removes marking from the current shape
 o contains(int, int)
Returns true iff this shape contains the given point
 o distance(Point, Point)
Returns the distance between two points
 o draw(Graphics)
Draws the shape on the screen
 o drawDashedLine(Graphics, int, int, int, int, int, int)
Draws dashed line between two given points
 o getAlignment()
Returns the description text alignment
 o getCenter()
Returns the shape center point
 o getDirection()
Returns the shape drawing direction
 o getDragPoints()
Returns the array of shape's drag points
 o getHasText()
Returns the value of hasText flag
 o getHeight()
Returns the shape height
 o getHigh()
Returns the shape's high drag points
 o getInchHeight()
Returns the shape's height (in pixels)
 o getInchWidth()
Returns the shape's width (in pixels)
 o getInchX()
Returns the shape's X coordinate (in inches)
 o getInchY()
Returns the shape's Y coordinate (in inches)
 o getLeft()
Returns the shape's left drag points
 o getLineStyle()
Returns the shape drawing style
 o getLow()
Returns the shape's low drag points
 o getResizeDirection(int)
Returns the drag direction according to point
 o getResizeText()
Returns the pic text for this shape after resizing
 o getRight()
Returns the shape's right drag points
 o getShapeAsInt()
Returns the shape's type
 o getText()
Returns the description text for this shape
 o getWidth()
Returns the shape width
 o getX()
Returns the shape's X coordinate (in pixels)
 o getY()
Returns the shape's Y coordinate
 o inverse()
Inverses the Y coordinate of the shape.
 o isSelected(int, int, int, int)
Returns true if the shape is included into the given rectangular frame
 o lineStyletoString()
Returns the shape's line style as a string
 o markAsCurrent(Graphics)
Markes the shape as current
 o markElement(Graphics, Color, boolean)
Markes the shape with given color
 o moveTo(Point)
Moves the shape to the given point
 o placeText(Graphics)
Draw a description text for this shape
 o setAlignment(int[])
Sets new description text alignment for this shape
 o setCurrentPoint(int)
Sets current drag point
 o setDirection(int)
Sets new drawing direction
 o setHeight(int)
Sets new height for this shape (in pixels)
 o setInchHeight(double)
Sets new height for this shape (in inches)
 o setInchWidth(double)
Sets new width for this shape (in inches)
 o setInchX(double)
Sets new X position (in inches)
 o setInchY(double)
Sets new Y position (in inches)
 o setInsertionPoint()
Sets the current drawing position
 o setStyle(int)
Set new drawing style for this shape
 o setText(String[])
Sets new description text for this shape
 o setTextPresent(boolean)
Sets the hasTextFlag for this shape
 o setWidth(int)
Sets new width for this shape (in pixels)
 o setX(int)
Sets new X position (in pixels)
 o setY(int)
Sets new Y position (in pixels)
 o shapeText()
Returns the pic text assotiated with this shape
 o showParameters(StatusBar, StatusBar, StatusBar, StatusBar)
Shows the shape's parameters in the given windows
 o unMarkElement(Graphics)
Unmarks the current shape

Variables

 o shapeX
 protected int shapeX
shape's X coordinate on the screen

 o shapeY
 protected int shapeY
shape's Y coordinate on the screen

 o direction
 protected int direction
shape's drawing direction. Possible values:

See Also:
Diamond
 o text
 protected String text[]
description text associated with this shape

 o alignment
 protected int alignment[]
alignment of the description text associated with this shape

 o CENTER
 public static final int CENTER
center alignment of the description text

 o LJUST
 public static final int LJUST
left alignment of the description text

 o RJUST
 public static final int RJUST
right alignment of the description text

 o ABOVE
 public static final int ABOVE
the description text is drawn above this shape

 o BELOW
 public static final int BELOW
the description text is drawn below this shape

 o SPECIAL
 public static final int SPECIAL
the description text has a special alignment not supported by the application

 o hasText
 protected boolean hasText
set to true iff this shape has a description text

 o lineStyle
 protected int lineStyle
drawing style (solid/dashed/dotted/invisible)

 o SOLID
 public static final int SOLID
solid line style

 o DASHED
 public static final int DASHED
dashed line style

 o DOTTED
 public static final int DOTTED
dotted line style

 o INVISIBLE
 public static final int INVISIBLE
invisible line style

 o DASHSIZE
 public static final int DASHSIZE
dashed line segment length

 o MINHEIGHT
 protected static final int MINHEIGHT
 o MINWIDTH
 protected static final int MINWIDTH

Constructors

 o GenericShape
 protected GenericShape()
Constructs the shape and initializes its coordinates with global ones.

Methods

 o lineStyletoString
 public String lineStyletoString()
Returns the shape's line style as a string

 o alignmentToString
 public static String alignmentToString(int alignment)
Returns the shape description text's alignment as string

 o getDirection
 public int getDirection()
Returns the shape drawing direction

 o getX
 public int getX()
Returns the shape's X coordinate (in pixels)

 o getInchX
 public double getInchX()
Returns the shape's X coordinate (in inches)

 o getY
 public int getY()
Returns the shape's Y coordinate

 o getInchY
 public double getInchY()
Returns the shape's Y coordinate (in inches)

 o getHeight
 public abstract int getHeight()
Returns the shape height

 o getWidth
 public abstract int getWidth()
Returns the shape width

 o getText
 public String[] getText()
Returns the description text for this shape

 o setX
 public void setX(int newX)
Sets new X position (in pixels)

 o setInchX
 public void setInchX(double inchX)
Sets new X position (in inches)

 o setY
 public void setY(int newY)
Sets new Y position (in pixels)

 o setInchY
 public void setInchY(double inchY)
Sets new Y position (in inches)

 o setHeight
 public abstract void setHeight(int newHeight)
Sets new height for this shape (in pixels)

 o setWidth
 public abstract void setWidth(int newWidth)
Sets new width for this shape (in pixels)

 o getInchHeight
 public double getInchHeight()
Returns the shape's height (in pixels)

 o getLineStyle
 public int getLineStyle()
Returns the shape drawing style

 o getInchWidth
 public double getInchWidth()
Returns the shape's width (in pixels)

 o setInchHeight
 public void setInchHeight(double inchHeight)
Sets new height for this shape (in inches)

 o setInchWidth
 public void setInchWidth(double inchWidth)
Sets new width for this shape (in inches)

 o setTextPresent
 public void setTextPresent(boolean present)
Sets the hasTextFlag for this shape

 o getHasText
 public boolean getHasText()
Returns the value of hasText flag

 o showParameters
 public abstract void showParameters(StatusBar height,
                                     StatusBar width,
                                     StatusBar radius,
                                     StatusBar text)
Shows the shape's parameters in the given windows

Parameters:
height - the StatusBar were the shape's height will be shown
width - the StatusBar were the shape's width will be shown
 o atPositionAsString
 public abstract String atPositionAsString()
Returns the shape's position as a pic text

 o setInsertionPoint
 public abstract void setInsertionPoint()
Sets the current drawing position

 o getDragPoints
 public abstract Point[] getDragPoints()
Returns the array of shape's drag points

 o getResizeDirection
 public abstract Point getResizeDirection(int point)
Returns the drag direction according to point

 o setCurrentPoint
 public void setCurrentPoint(int point)
Sets current drag point

 o clearElement
 public void clearElement(Graphics g)
Removes marking from the current shape

 o markElement
 public void markElement(Graphics g,
                         Color color,
                         boolean single)
Markes the shape with given color

Parameters:
g - current Graphics object
color - marking color
single - does this shape single or belong to a group
 o markAsCurrent
 public void markAsCurrent(Graphics g)
Markes the shape as current

 o unMarkElement
 public void unMarkElement(Graphics g)
Unmarks the current shape

 o draw
 public abstract void draw(Graphics g)
Draws the shape on the screen

 o contains
 public abstract boolean contains(int x,
                                  int y)
Returns true iff this shape contains the given point

Parameters:
x - the X coordinate of checked point
y - the Y coordinate of checked point
Overrides:
contains in class Component
 o shapeText
 public abstract String shapeText()
Returns the pic text assotiated with this shape

 o isSelected
 public abstract boolean isSelected(int x,
                                    int y,
                                    int _width,
                                    int _height)
Returns true if the shape is included into the given rectangular frame

Parameters:
x - the X coordinate of selecting fame's left upper corner
y - the Y coordinate of selecting fame's left upper corner
_width - the selecting frame's width
_width - the selecting frame's height
 o setDirection
 public void setDirection(int direction)
Sets new drawing direction

 o getResizeText
 public abstract String getResizeText()
Returns the pic text for this shape after resizing

 o setText
 public void setText(String text[])
Sets new description text for this shape

 o setAlignment
 public void setAlignment(int alignment[])
Sets new description text alignment for this shape

 o getAlignment
 public int[] getAlignment()
Returns the description text alignment

 o inverse
 public abstract void inverse()
Inverses the Y coordinate of the shape. (Translates the pic coordinates to application coordinates

 o center
 public abstract int[] center(int borders[])
Returns the most left and most rigth points for this shape. This method is used for centering the picture

 o getCenter
 protected abstract Point getCenter()
Returns the shape center point

 o getLeft
 protected abstract Point getLeft()
Returns the shape's left drag points

 o getRight
 protected abstract Point getRight()
Returns the shape's right drag points

 o getLow
 protected abstract Point getLow()
Returns the shape's low drag points

 o getHigh
 protected abstract Point getHigh()
Returns the shape's high drag points

 o getShapeAsInt
 public abstract int getShapeAsInt()
Returns the shape's type

 o placeText
 protected void placeText(Graphics graphics)
Draw a description text for this shape

 o setStyle
 public void setStyle(int newLineStyle)
Set new drawing style for this shape

 o drawDashedLine
 public static void drawDashedLine(Graphics g,
                                   int dash_size,
                                   int space,
                                   int x1,
                                   int y1,
                                   int x2,
                                   int y2)
Draws dashed line between two given points

Parameters:
g - current Graphics object
dash_size - the size of dash segment
space - the space between adjecent dashes
x1 - the X coordinate of 1st point
y1 - the Y coordinate of 1st point
x2 - the X co the Y coordinate of 2nd point
y2 - the Y coordinate of 2nd point
 o moveTo
 public abstract void moveTo(Point newLocation)
Moves the shape to the given point

 o distance
 public static double distance(Point p1,
                               Point p2)
Returns the distance between two points


All Packages  Class Hierarchy  This Package  Previous  Next  Index