當前位置: 首頁>>代碼示例>>Java>>正文


Java Point.getTranslated方法代碼示例

本文整理匯總了Java中org.eclipse.draw2d.geometry.Point.getTranslated方法的典型用法代碼示例。如果您正苦於以下問題:Java Point.getTranslated方法的具體用法?Java Point.getTranslated怎麽用?Java Point.getTranslated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.draw2d.geometry.Point的用法示例。


在下文中一共展示了Point.getTranslated方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: paintFigure

import org.eclipse.draw2d.geometry.Point; //導入方法依賴的package包/類
@Override
protected void paintFigure(Graphics g) {
	super.paintFigure(g);
	
	Rectangle r = getBounds();
	Rectangle square = new Rectangle(r.getLocation().getTranslated(0, r.height/4), new Dimension(r.width/2, r.height/2));
	center = new Point(square.x + square.width/2, square.y + square.height/2);

	g.setBackgroundColor(dirty ? PandionJConstants.Colors.HIGHLIGHT : PandionJConstants.Colors.VARIABLE_BOX);
	g.fillRectangle(square);

	g.setForegroundColor(ref.getRole() == Role.FIXED_VALUE ? PandionJConstants.Colors.CONSTANT : ColorConstants.black);
	g.drawRectangle(square);

	g.setBackgroundColor(error ? PandionJConstants.Colors.ERROR : ColorConstants.black);
	g.fillOval(center.x-3, center.y-3, 7, 7);

	if(isnull) {
		g.setForegroundColor(error ? PandionJConstants.Colors.ERROR : ColorConstants.black);
		Point dest = center.getTranslated(20, 0);
		g.drawLine(center, dest);
		g.drawLine(dest.getTranslated(-3, 5), dest.getTranslated(3, -5));
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:25,代碼來源:ReferenceLabel.java

示例2: paint

import org.eclipse.draw2d.geometry.Point; //導入方法依賴的package包/類
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
	graphics.setForegroundColor(PandionJConstants.Colors.ROLE_ANNOTATIONS);
	Rectangle r = figure.getBounds();
	int startY = direction == Direction.FORWARD ? 2 : 1 + (PandionJConstants.POSITION_WIDTH/3)*2;
	Point from = r.getLocation().getTranslated(r.width-6, startY);
	Point to = from.getTranslated(0, PandionJConstants.POSITION_WIDTH / 4);
	if(direction == Direction.FORWARD) {
		Point t = from;
		from = to;
		to = t;
	}
	drawArrow(graphics, from, to); 
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:15,代碼來源:ValueFigure.java

示例3: drawBar

import org.eclipse.draw2d.geometry.Point; //導入方法依賴的package包/類
private void drawBar(Graphics g, Integer boundVal, IBound bound, Direction direction) {
	if(direction != Direction.NONE) {
		Point origin = getIndexLocation(boundVal);
		
		int s;
		boolean b = direction == Direction.FORWARD && bound.getType() == BoundType.CLOSE ||
				direction == Direction.BACKWARD && bound.getType() == BoundType.OPEN;
		
		if(horizontal){
			s = firstLabelBounds.width/2 + PandionJConstants.ARRAY_POSITION_SPACING; 
			if(!b)
				s = -s;
		}else{ 
			s = firstPositionBounds.height/2 + PandionJConstants.ARRAY_POSITION_SPACING;
			if(!b)
				s = -s;
		}

		origin.translate(horizontal ? s : 0, horizontal ? 0 : s);

		Point from = origin.getTranslated(horizontal ? 0 : -BAR_HEIGHT, horizontal ? -BAR_HEIGHT : 0);; 

		Point to = origin.getTranslated(horizontal ? 0 : BAR_HEIGHT, horizontal ? BAR_HEIGHT : 0);
		setIllustrationStyle(g);
		g.drawLine(from, to);
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:28,代碼來源:IllustrationBorder.java

示例4: drawArrow

import org.eclipse.draw2d.geometry.Point; //導入方法依賴的package包/類
private void drawArrow(Point from, Point to, int pWidth, boolean right, Graphics graphics) {
	Point arrowTo = to.getTranslated(right ? 0 : pWidth/2, 0);
	graphics.drawLine(from.getTranslated(right ? pWidth : 0, pWidth), arrowTo);
	Point a = arrowTo.getTranslated(right ? -ARROW_EDGE : ARROW_EDGE, -ARROW_EDGE);
	graphics.drawLine(arrowTo, a);
	a = a.getTranslated(0, ARROW_EDGE*2);
	graphics.drawLine(arrowTo, a);
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:9,代碼來源:ArrayPrimitiveFigure.java

示例5: paintBorder

import org.eclipse.draw2d.geometry.Point; //導入方法依賴的package包/類
@Override
protected void paintBorder(Graphics graphics) {
	super.paintBorder(graphics);
	for(IArrayIndexModel v : vars.values()) {
		if(v.getBound() != null) {
			Point origin = getIndexLocation(v.getBound().getValue());
			Point from = origin.getTranslated(0, -100);
			Point to = origin.getTranslated(0, 100);
			graphics.drawLine(from, to);
		}
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:13,代碼來源:ArrayPrimitiveFigure.java


注:本文中的org.eclipse.draw2d.geometry.Point.getTranslated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。