当前位置: 首页>>代码示例>>Java>>正文


Java PositionConstants.NORTH_WEST属性代码示例

本文整理汇总了Java中org.eclipse.draw2d.PositionConstants.NORTH_WEST属性的典型用法代码示例。如果您正苦于以下问题:Java PositionConstants.NORTH_WEST属性的具体用法?Java PositionConstants.NORTH_WEST怎么用?Java PositionConstants.NORTH_WEST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.draw2d.PositionConstants的用法示例。


在下文中一共展示了PositionConstants.NORTH_WEST属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

/**
 * Initializes this obstacle to the values of the given rectangle
 * 
 * @param rect
 *            bounds of this obstacle
 */
void init(Rectangle rect) {
	this.x = rect.x;
	this.y = rect.y;
	this.width = rect.width;
	this.height = rect.height;

	exclude = false;

	topLeft = new Vertex(x, y, this);
	topLeft.positionOnObstacle = PositionConstants.NORTH_WEST;
	topRight = new Vertex(x + width - 1, y, this);
	topRight.positionOnObstacle = PositionConstants.NORTH_EAST;
	bottomLeft = new Vertex(x, y + height - 1, this);
	bottomLeft.positionOnObstacle = PositionConstants.SOUTH_WEST;
	bottomRight = new Vertex(x + width - 1, y + height - 1, this);
	bottomRight.positionOnObstacle = PositionConstants.SOUTH_EAST;
	center = new Vertex(getCenter(), this);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:24,代码来源:Obstacle.java

示例2: calculateCorrectPoint

/**
 * This method calculates and returns the correct refrence point of a {@link Rectangle} in regards
 * to a given Point.
 * */
protected Point calculateCorrectPoint(Rectangle rec, Point locationOfOther) {
  // TODO: doesn't work properly for the shape connection anchors of a relation
  switch (rec.getPosition(locationOfOther)) {
    case PositionConstants.NORTH:
      return rec.getTop();
    case PositionConstants.NORTH_EAST:
      return rec.getTop();
    case PositionConstants.NORTH_WEST:
      return rec.getTop();
    case PositionConstants.EAST:
      return rec.getRight();
    case PositionConstants.WEST:
      return rec.getLeft();
    case PositionConstants.SOUTH:
      return rec.getBottom();
    case PositionConstants.SOUTH_EAST:
      return rec.getBottom();
    case PositionConstants.SOUTH_WEST:
      return rec.getBottom();
    default:
      return rec.getCenter();
  }
}
 
开发者ID:leondart,项目名称:FRaMED,代码行数:27,代码来源:ORMRelationCreateCommand.java

示例3: addSegmentsFor

/**
 * Adds the segments between the given obstacles.
 * 
 * @param source
 *            source obstacle
 * @param target
 *            target obstacle
 */
private void addSegmentsFor(Vertex vertex, Obstacle obs) {
	Segment seg = null;
	Segment seg2 = null;

	switch (obs.getPosition(vertex)) {
	case PositionConstants.SOUTH_WEST:
	case PositionConstants.NORTH_EAST:
		seg = new Segment(vertex, obs.topLeft);
		seg2 = new Segment(vertex, obs.bottomRight);
		break;
	case PositionConstants.SOUTH_EAST:
	case PositionConstants.NORTH_WEST:
		seg = new Segment(vertex, obs.topRight);
		seg2 = new Segment(vertex, obs.bottomLeft);
		break;
	case PositionConstants.NORTH:
		seg = new Segment(vertex, obs.topLeft);
		seg2 = new Segment(vertex, obs.topRight);
		break;
	case PositionConstants.EAST:
		seg = new Segment(vertex, obs.bottomRight);
		seg2 = new Segment(vertex, obs.topRight);
		break;
	case PositionConstants.SOUTH:
		seg = new Segment(vertex, obs.bottomRight);
		seg2 = new Segment(vertex, obs.bottomLeft);
		break;
	case PositionConstants.WEST:
		seg = new Segment(vertex, obs.topLeft);
		seg2 = new Segment(vertex, obs.bottomLeft);
		break;
	default:
		if (vertex.x == obs.x) {
			seg = new Segment(vertex, obs.topLeft);
			seg2 = new Segment(vertex, obs.bottomLeft);
		} else if (vertex.y == obs.y) {
			seg = new Segment(vertex, obs.topLeft);
			seg2 = new Segment(vertex, obs.topRight);
		} else if (vertex.y == obs.bottom() - 1) {
			seg = new Segment(vertex, obs.bottomLeft);
			seg2 = new Segment(vertex, obs.bottomRight);
		} else if (vertex.x == obs.right() - 1) {
			seg = new Segment(vertex, obs.topRight);
			seg2 = new Segment(vertex, obs.bottomRight);
		} else {
			throw new RuntimeException("Unexpected vertex conditions"); //$NON-NLS-1$
		}
	}

	stack.push(obs);
	stack.push(null);
	stack.push(seg);
	stack.push(obs);
	stack.push(null);
	stack.push(seg2);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:64,代码来源:Path.java

示例4: createSelectionHandles

/**
 * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#createSelectionHandles()
 */
protected List createSelectionHandles( )
{
	List list = new ArrayList( );

	if ( this.getResizeDirections( ) != -1 )
	{
		ReportResizableHandleKit.addMoveHandle( (GraphicalEditPart) getHost( ), list );
		if ( ( this.getResizeDirections( ) & PositionConstants.EAST ) != 0 )
			ReportResizableHandleKit.addHandle( (GraphicalEditPart) getHost( ),
					list,
					PositionConstants.EAST );
		if ( ( this.getResizeDirections( ) & PositionConstants.SOUTH_EAST ) == PositionConstants.SOUTH_EAST )
			ReportResizableHandleKit.addHandle( (GraphicalEditPart) getHost( ),
					list,
					PositionConstants.SOUTH_EAST );
		if ( ( this.getResizeDirections( ) & PositionConstants.SOUTH ) != 0 )
			ReportResizableHandleKit.addHandle( (GraphicalEditPart) getHost( ),
					list,
					PositionConstants.SOUTH );
		if ( ( this.getResizeDirections( ) & PositionConstants.SOUTH_WEST ) == PositionConstants.SOUTH_WEST )
			ReportResizableHandleKit.addHandle( (GraphicalEditPart) getHost( ),
					list,
					PositionConstants.SOUTH_WEST );
		if ( ( this.getResizeDirections( ) & PositionConstants.WEST ) != 0 )
			ReportResizableHandleKit.addHandle( (GraphicalEditPart) getHost( ),
					list,
					PositionConstants.WEST );
		if ( ( this.getResizeDirections( ) & PositionConstants.NORTH_WEST ) == PositionConstants.NORTH_WEST )
			ReportResizableHandleKit.addHandle( (GraphicalEditPart) getHost( ),
					list,
					PositionConstants.NORTH_WEST );
		if ( ( this.getResizeDirections( ) & PositionConstants.NORTH ) != 0 )
			ReportResizableHandleKit.addHandle( (GraphicalEditPart) getHost( ),
					list,
					PositionConstants.NORTH );
		if ( ( this.getResizeDirections( ) & PositionConstants.NORTH_EAST ) == PositionConstants.NORTH_EAST )
			ReportResizableHandleKit.addHandle( (GraphicalEditPart) getHost( ),
					list,
					PositionConstants.NORTH_EAST );
	}
	else
		ReportResizableHandleKit.addHandles( (GraphicalEditPart) getHost( ), list );

	return list;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:48,代码来源:ReportElementResizablePolicy.java


注:本文中的org.eclipse.draw2d.PositionConstants.NORTH_WEST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。