|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodeblocks.BlockShape
public class BlockShape
This class separates block shape from the RenderableBlock class. BlockShape uses information from RenderableBlock to determine shape and dimensions of the block being drawn. BlockShape does not know where it is in the world -- all coords are local.
Field Summary | |
---|---|
protected static BlockConnectorShape |
BCS
Draws the individual connectors. |
protected Block |
block
The Block associated to this BlockShape |
protected java.awt.Rectangle |
blockBody
Body of the block |
protected float |
blockCornerRadius
|
protected long |
blockID
The blockID associated to this BlockShape |
protected java.awt.geom.Point2D |
botLeftCorner
|
protected java.awt.geom.Point2D |
botRightCorner
|
static float |
BOTTOM_SOCKET_MIDDLE_SPACER
spacer for in between bottom sockets |
static float |
BOTTOM_SOCKET_SIDE_SPACER
spacer for bottom sockets to block sides and other bottom sockets |
static float |
BOTTOM_SOCKET_UPPER_SPACER
spacer on top of bottom sockets to give continuous top |
protected static BlockShapeUtil |
BSU
Tools to draw block shape. |
static float |
COMMAND_PORT_OFFSET
left alignment buffer for command ports |
static float |
CORNER_RADIUS
radius of rounded corners |
protected java.awt.geom.GeneralPath |
gpBottom
Outline of bottom-left conrner, bottom edge, and bottom-right corner (Counter-Clockwise) |
protected boolean |
hasCurvedCorners
block properties determining shape |
protected RenderableBlock |
rb
The RenderableBlock associated to this BlockShape |
protected java.awt.geom.Point2D |
topLeftCorner
|
protected java.awt.geom.Point2D |
topRightCorner
|
static float |
VARIABLE_DECLARATION_SPACER
variable declaration spacer |
Constructor Summary | |
---|---|
BlockShape(RenderableBlock rb)
BlockShape constructor |
Method Summary | |
---|---|
static void |
addCustomShapes(CustomBlockShapeSet cbs)
Add a new set of custom shapes |
protected int |
determineBlockHeight()
Determines the height of a block by summing it's socket heights OR plug height if no sockets TODO: this contains a lot of starlogo specific checks - should be refactored into slcodeblocks? |
protected int |
determineBlockWidth()
Determines the width of the block by checking for numerous block characteristics TODO: this contains a lot of starlogo specific checks - should be refactored into slcodeblocks? |
protected java.awt.geom.GeneralPath |
getBottomSide()
Returns the GeneralPath of the bottom side of this block shape. |
protected java.awt.geom.GeneralPath |
getLeftSide()
Returns the GeneralPath of the left side of this block shape. |
protected java.awt.geom.GeneralPath |
getRightSide()
Returns the GeneralPath of the right side of this block shape. |
protected int |
getSocketSpacerHeight(BlockConnector socket,
float defaultHeight)
Returns the height of the spacer associated with a socket if it exists, else it returns the given default height. |
protected java.awt.geom.GeneralPath |
getTopSide()
Returns the GeneralPath of the top side of this block shape. |
protected int |
getTotalHeightOfSockets()
Returns the total height of this blocks sockets based on connector shape and position type; 0 if this block has no sockets |
protected void |
makeBottomSide()
|
protected void |
makeLeftSide()
|
protected void |
makeRightSide()
|
protected void |
makeTopSide()
|
java.awt.geom.Area |
reformArea()
Reform the BlockShape area. |
protected void |
setEndPoint(java.awt.geom.GeneralPath gp,
java.awt.geom.Point2D currentCorner,
java.awt.geom.Point2D otherCorner,
boolean firstPointOnSide)
Sets the end point for a particular side of a block. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static BlockConnectorShape BCS
protected static BlockShapeUtil BSU
protected RenderableBlock rb
protected long blockID
protected Block block
public static final float COMMAND_PORT_OFFSET
public static final float CORNER_RADIUS
public static final float VARIABLE_DECLARATION_SPACER
public static final float BOTTOM_SOCKET_SIDE_SPACER
public static final float BOTTOM_SOCKET_MIDDLE_SPACER
public static final float BOTTOM_SOCKET_UPPER_SPACER
protected java.awt.geom.GeneralPath gpBottom
protected java.awt.Rectangle blockBody
protected java.awt.geom.Point2D topLeftCorner
protected java.awt.geom.Point2D topRightCorner
protected java.awt.geom.Point2D botLeftCorner
protected java.awt.geom.Point2D botRightCorner
protected boolean hasCurvedCorners
protected float blockCornerRadius
Constructor Detail |
---|
public BlockShape(RenderableBlock rb)
rb
- Method Detail |
---|
protected int determineBlockWidth()
protected int getTotalHeightOfSockets()
protected int determineBlockHeight()
protected void makeTopSide()
protected void makeRightSide()
protected void makeLeftSide()
protected void makeBottomSide()
protected void setEndPoint(java.awt.geom.GeneralPath gp, java.awt.geom.Point2D currentCorner, java.awt.geom.Point2D otherCorner, boolean firstPointOnSide)
protected int getSocketSpacerHeight(BlockConnector socket, float defaultHeight)
protected java.awt.geom.GeneralPath getBottomSide()
protected java.awt.geom.GeneralPath getLeftSide()
protected java.awt.geom.GeneralPath getTopSide()
protected java.awt.geom.GeneralPath getRightSide()
public java.awt.geom.Area reformArea()
public static void addCustomShapes(CustomBlockShapeSet cbs)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |