本文整理汇总了Java中edu.mit.blocks.codeblocks.rendering.BlockShapeUtil.cornerTo方法的典型用法代码示例。如果您正苦于以下问题:Java BlockShapeUtil.cornerTo方法的具体用法?Java BlockShapeUtil.cornerTo怎么用?Java BlockShapeUtil.cornerTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.mit.blocks.codeblocks.rendering.BlockShapeUtil
的用法示例。
在下文中一共展示了BlockShapeUtil.cornerTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeBottomSide
import edu.mit.blocks.codeblocks.rendering.BlockShapeUtil; //导入方法依赖的package包/类
protected void makeBottomSide() {
//start bottom-right
setEndPoint(gpBottom, botLeftCorner, topLeftCorner, true);
//curve down and right
BlockShapeUtil.cornerTo(gpBottom, botLeftCorner, botRightCorner, blockCornerRadius);
/// CONTROL CONNECTOR
// Removing the isCommandBlock requirement for now because procedure block has an after connector
//if (block.isCommandBlock() && block.hasAfterConnector()) {
if (block.hasAfterConnector() && !rb.isCollapsed()) {
//control connector if necessary
// Trying left-aligned ports
Point2D p = BCS.addControlConnectorShape(gpBottom, (float) COMMAND_PORT_OFFSET + blockCornerRadius, true);
rb.updateSocketPoint(block.getAfterConnector(), p);
}
//curve right and up
BlockShapeUtil.cornerTo(gpBottom, botRightCorner, topRightCorner, blockCornerRadius);
//end bottom
setEndPoint(gpBottom, botRightCorner, topRightCorner, false);
}
示例2: makeTopSide
import edu.mit.blocks.codeblocks.rendering.BlockShapeUtil; //导入方法依赖的package包/类
protected void makeTopSide() {
//starting point of the block
//gpTop.moveTo((float) topLeftCorner.getX(), (float) topLeftCorner.getY() + blockCornerRadius);
setEndPoint(gpTop, topLeftCorner, botLeftCorner, true);
//curve up and right
BlockShapeUtil.cornerTo(gpTop, topLeftCorner, topRightCorner, blockCornerRadius);
//command socket if necessary
if (block.isCommandBlock() && block.hasBeforeConnector()) {
//params: path, distance to center of block, going right
// Old center-aligned ports
//Point2D p = BCS.addControlConnectorShape(gpTop, (float) topLeftCorner.distance(topRightCorner) / 2 - blockCornerRadius, true);
// Trying left-aligned ports for now
Point2D p = BCS.addControlConnectorShape(gpTop, (float) COMMAND_PORT_OFFSET + blockCornerRadius, true);
rb.updateSocketPoint(block.getBeforeConnector(), p);
}
//curve down
BlockShapeUtil.cornerTo(gpTop, topRightCorner, botRightCorner, blockCornerRadius);
//end topside
//gpTop.lineTo(blockBody.x + blockBody.width, blockBody.y + blockCornerRadius);
//gpTop.lineTo((float) topRightCorner.getX(), (float) topRightCorner.getY() + blockCornerRadius);
setEndPoint(gpTop, topRightCorner, botRightCorner, false);
}
示例3: addCommandSocket
import edu.mit.blocks.codeblocks.rendering.BlockShapeUtil; //导入方法依赖的package包/类
public Point2D addCommandSocket(GeneralPath blockPath, int commandSocketHeight) {
//draw bar
BlockShapeUtil.lineToRelative(blockPath, COMMAND_INPUT_BAR_WIDTH, 0);
BlockShapeUtil.lineToRelative(blockPath, 0, COMMAND_INPUT_BAR_HEIGHT);
Point2D socketPoint = addControlConnectorShape(blockPath, false);
//first corner inside command input
BlockShapeUtil.cornerTo(blockPath,
new Point2D.Float(
(float) blockPath.getCurrentPoint().getX() - COMMAND_INPUT_BAR_WIDTH + BlockShape.CORNER_RADIUS,
(float) blockPath.getCurrentPoint().getY()),
new Point2D.Float(
(float) blockPath.getCurrentPoint().getX() - COMMAND_INPUT_BAR_WIDTH + BlockShape.CORNER_RADIUS,
(float) blockPath.getCurrentPoint().getY() + BlockShape.CORNER_RADIUS),
BlockShape.CORNER_RADIUS);
//insert dynamic command input height between these two methods
BlockShapeUtil.lineToRelative(blockPath, 0, commandSocketHeight);
//second corner at bottom of command input
BlockShapeUtil.cornerTo(blockPath,
new Point2D.Float(
(float) blockPath.getCurrentPoint().getX(),
(float) blockPath.getCurrentPoint().getY() + BlockShape.CORNER_RADIUS),
new Point2D.Float(
(float) blockPath.getCurrentPoint().getX() + BlockShape.CORNER_RADIUS,
(float) blockPath.getCurrentPoint().getY() + BlockShape.CORNER_RADIUS),
BlockShape.CORNER_RADIUS);
//extend left to match y coordinate of initial point
BlockShapeUtil.lineToRelative(blockPath, CONTROL_PLUG_WIDTH / 2, 0);
return socketPoint;
}