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
-
ABOVE
- the description text is drawn above this shape
-
alignment
- alignment of the description text associated with this shape
-
BELOW
- the description text is drawn below this shape
-
CENTER
- center alignment of the description text
-
DASHED
- dashed line style
-
DASHSIZE
- dashed line segment length
-
direction
- shape's drawing direction.
-
DOTTED
- dotted line style
-
hasText
- set to true iff this shape has a description text
-
INVISIBLE
- invisible line style
-
lineStyle
- drawing style (solid/dashed/dotted/invisible)
-
LJUST
- left alignment of the description text
-
MINHEIGHT
-
-
MINWIDTH
-
-
RJUST
- right alignment of the description text
-
shapeX
- shape's X coordinate on the screen
-
shapeY
- shape's Y coordinate on the screen
-
SOLID
- solid line style
-
SPECIAL
- the description text has a special alignment not supported by the application
-
text
- description text associated with this shape
-
GenericShape()
- Constructs the shape and initializes its coordinates with global ones.
-
alignmentToString(int)
- Returns the shape description text's alignment as string
-
atPositionAsString()
- Returns the shape's position as a pic text
-
center(int[])
- Returns the most left and most rigth points for this shape.
-
clearElement(Graphics)
- Removes marking from the current shape
-
contains(int, int)
- Returns true iff this shape contains the given point
-
distance(Point, Point)
- Returns the distance between two points
-
draw(Graphics)
- Draws the shape on the screen
-
drawDashedLine(Graphics, int, int, int, int, int, int)
- Draws dashed line between two given points
-
getAlignment()
- Returns the description text alignment
-
getCenter()
- Returns the shape center point
-
getDirection()
- Returns the shape drawing direction
-
getDragPoints()
- Returns the array of shape's drag points
-
getHasText()
- Returns the value of hasText flag
-
getHeight()
- Returns the shape height
-
getHigh()
- Returns the shape's high drag points
-
getInchHeight()
- Returns the shape's height (in pixels)
-
getInchWidth()
- Returns the shape's width (in pixels)
-
getInchX()
- Returns the shape's X coordinate (in inches)
-
getInchY()
- Returns the shape's Y coordinate (in inches)
-
getLeft()
- Returns the shape's left drag points
-
getLineStyle()
- Returns the shape drawing style
-
getLow()
- Returns the shape's low drag points
-
getResizeDirection(int)
- Returns the drag direction according to point
-
getResizeText()
- Returns the pic text for this shape after resizing
-
getRight()
- Returns the shape's right drag points
-
getShapeAsInt()
- Returns the shape's type
-
getText()
- Returns the description text for this shape
-
getWidth()
- Returns the shape width
-
getX()
- Returns the shape's X coordinate (in pixels)
-
getY()
- Returns the shape's Y coordinate
-
inverse()
- Inverses the Y coordinate of the shape.
-
isSelected(int, int, int, int)
- Returns true if the shape is included into the given rectangular frame
-
lineStyletoString()
- Returns the shape's line style as a string
-
markAsCurrent(Graphics)
- Markes the shape as current
-
markElement(Graphics, Color, boolean)
- Markes the shape with given color
-
moveTo(Point)
- Moves the shape to the given point
-
placeText(Graphics)
- Draw a description text for this shape
-
setAlignment(int[])
- Sets new description text alignment for this shape
-
setCurrentPoint(int)
- Sets current drag point
-
setDirection(int)
- Sets new drawing direction
-
setHeight(int)
- Sets new height for this shape (in pixels)
-
setInchHeight(double)
- Sets new height for this shape (in inches)
-
setInchWidth(double)
- Sets new width for this shape (in inches)
-
setInchX(double)
- Sets new X position (in inches)
-
setInchY(double)
- Sets new Y position (in inches)
-
setInsertionPoint()
- Sets the current drawing position
-
setStyle(int)
- Set new drawing style for this shape
-
setText(String[])
- Sets new description text for this shape
-
setTextPresent(boolean)
- Sets the hasTextFlag for this shape
-
setWidth(int)
- Sets new width for this shape (in pixels)
-
setX(int)
- Sets new X position (in pixels)
-
setY(int)
- Sets new Y position (in pixels)
-
shapeText()
- Returns the pic text assotiated with this shape
-
showParameters(StatusBar, StatusBar, StatusBar, StatusBar)
- Shows the shape's parameters in the given windows
-
unMarkElement(Graphics)
- Unmarks the current shape
shapeX
protected int shapeX
- shape's X coordinate on the screen
shapeY
protected int shapeY
- shape's Y coordinate on the screen
direction
protected int direction
- shape's drawing direction.
Possible values:
- Diamond.UP
- Diamond.DOWN
- Diamond.LEFT
- Diamond.RIGHT
- See Also:
- Diamond
text
protected String text[]
- description text associated with this shape
alignment
protected int alignment[]
- alignment of the description text associated with this shape
CENTER
public static final int CENTER
- center alignment of the description text
LJUST
public static final int LJUST
- left alignment of the description text
RJUST
public static final int RJUST
- right alignment of the description text
ABOVE
public static final int ABOVE
- the description text is drawn above this shape
BELOW
public static final int BELOW
- the description text is drawn below this shape
SPECIAL
public static final int SPECIAL
- the description text has a special alignment not supported by the application
hasText
protected boolean hasText
- set to true iff this shape has a description text
lineStyle
protected int lineStyle
- drawing style (solid/dashed/dotted/invisible)
SOLID
public static final int SOLID
- solid line style
DASHED
public static final int DASHED
- dashed line style
DOTTED
public static final int DOTTED
- dotted line style
INVISIBLE
public static final int INVISIBLE
- invisible line style
DASHSIZE
public static final int DASHSIZE
- dashed line segment length
MINHEIGHT
protected static final int MINHEIGHT
MINWIDTH
protected static final int MINWIDTH
GenericShape
protected GenericShape()
- Constructs the shape and initializes its coordinates with global ones.
lineStyletoString
public String lineStyletoString()
- Returns the shape's line style as a string
alignmentToString
public static String alignmentToString(int alignment)
- Returns the shape description text's alignment as string
getDirection
public int getDirection()
- Returns the shape drawing direction
getX
public int getX()
- Returns the shape's X coordinate (in pixels)
getInchX
public double getInchX()
- Returns the shape's X coordinate (in inches)
getY
public int getY()
- Returns the shape's Y coordinate
getInchY
public double getInchY()
- Returns the shape's Y coordinate (in inches)
getHeight
public abstract int getHeight()
- Returns the shape height
getWidth
public abstract int getWidth()
- Returns the shape width
getText
public String[] getText()
- Returns the description text for this shape
setX
public void setX(int newX)
- Sets new X position (in pixels)
setInchX
public void setInchX(double inchX)
- Sets new X position (in inches)
setY
public void setY(int newY)
- Sets new Y position (in pixels)
setInchY
public void setInchY(double inchY)
- Sets new Y position (in inches)
setHeight
public abstract void setHeight(int newHeight)
- Sets new height for this shape (in pixels)
setWidth
public abstract void setWidth(int newWidth)
- Sets new width for this shape (in pixels)
getInchHeight
public double getInchHeight()
- Returns the shape's height (in pixels)
getLineStyle
public int getLineStyle()
- Returns the shape drawing style
getInchWidth
public double getInchWidth()
- Returns the shape's width (in pixels)
setInchHeight
public void setInchHeight(double inchHeight)
- Sets new height for this shape (in inches)
setInchWidth
public void setInchWidth(double inchWidth)
- Sets new width for this shape (in inches)
setTextPresent
public void setTextPresent(boolean present)
- Sets the hasTextFlag for this shape
getHasText
public boolean getHasText()
- Returns the value of hasText flag
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
atPositionAsString
public abstract String atPositionAsString()
- Returns the shape's position as a pic text
setInsertionPoint
public abstract void setInsertionPoint()
- Sets the current drawing position
getDragPoints
public abstract Point[] getDragPoints()
- Returns the array of shape's drag points
getResizeDirection
public abstract Point getResizeDirection(int point)
- Returns the drag direction according to point
setCurrentPoint
public void setCurrentPoint(int point)
- Sets current drag point
clearElement
public void clearElement(Graphics g)
- Removes marking from the current shape
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
markAsCurrent
public void markAsCurrent(Graphics g)
- Markes the shape as current
unMarkElement
public void unMarkElement(Graphics g)
- Unmarks the current shape
draw
public abstract void draw(Graphics g)
- Draws the shape on the screen
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
shapeText
public abstract String shapeText()
- Returns the pic text assotiated with this shape
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
setDirection
public void setDirection(int direction)
- Sets new drawing direction
getResizeText
public abstract String getResizeText()
- Returns the pic text for this shape after resizing
setText
public void setText(String text[])
- Sets new description text for this shape
setAlignment
public void setAlignment(int alignment[])
- Sets new description text alignment for this shape
getAlignment
public int[] getAlignment()
- Returns the description text alignment
inverse
public abstract void inverse()
- Inverses the Y coordinate of the shape.
(Translates the pic coordinates to application coordinates
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
getCenter
protected abstract Point getCenter()
- Returns the shape center point
getLeft
protected abstract Point getLeft()
- Returns the shape's left drag points
getRight
protected abstract Point getRight()
- Returns the shape's right drag points
getLow
protected abstract Point getLow()
- Returns the shape's low drag points
getHigh
protected abstract Point getHigh()
- Returns the shape's high drag points
getShapeAsInt
public abstract int getShapeAsInt()
- Returns the shape's type
placeText
protected void placeText(Graphics graphics)
- Draw a description text for this shape
setStyle
public void setStyle(int newLineStyle)
- Set new drawing style for this shape
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
moveTo
public abstract void moveTo(Point newLocation)
- Moves the shape to the given point
distance
public static double distance(Point p1,
Point p2)
- Returns the distance between two points
All Packages Class Hierarchy This Package Previous Next Index