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


Java Graphics.drawPolyline方法代码示例

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


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

示例1: drawPolyline

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
	 * Draw polyline with the line style and line width of the trace.
	 * 
 * @param graphics
 * @param pl
 */
private void drawPolyline(Graphics graphics, PointList pl) {
	graphics.pushState();
	graphics.setLineWidth(lineWidth);
	switch(traceType) {
	case SOLID_LINE:
	case STEP_HORIZONTALLY:
	case STEP_VERTICALLY:
		graphics.setLineStyle(SWTConstants.LINE_SOLID);
		graphics.drawPolyline(pl);
		break;
	case DASH_LINE:
		graphics.setLineStyle(SWTConstants.LINE_DASH);
		graphics.drawPolyline(pl);
		break;
	default:
		break;
	}
	graphics.popState();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:26,代码来源:Trace.java

示例2: outlineShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * @see Shape#outlineShape(Graphics)
 */
protected void outlineShape(Graphics graphics) {
	DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();
	
	graphics.setAntialias(SWT.ON);
	graphics.setForegroundColor(color);
	graphics.setLineWidth(theme.getLineWidth());
	graphics.drawPolyline(getPoints());
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:12,代码来源:DwParentChildConnectionFigure.java

示例3: drawPoint

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * Draw point with the pointStyle and size of the trace;
 * 
 * @param graphics
 * @param pos
 */
public void drawPoint(Graphics graphics, Point pos) {
	// Shortcut when no point requested
	if (pointStyle == PointStyle.NONE)
		return;
	graphics.pushState();
	graphics.setBackgroundColor(traceColor);
	// graphics.setForegroundColor(traceColor);
	graphics.setLineWidth(1);
	graphics.setLineStyle(SWTConstants.LINE_SOLID);
	switch (pointStyle) {
	case POINT:
		graphics.fillOval(new Rectangle(pos.x - pointSize / 2, pos.y
				- pointSize / 2, pointSize, pointSize));
		break;
	case CIRCLE:
		graphics.drawOval(new Rectangle(pos.x - pointSize / 2, pos.y
				- pointSize / 2, pointSize, pointSize));
		break;
	case TRIANGLE:
		graphics.drawPolygon(new int[] { pos.x - pointSize / 2,
				pos.y + pointSize / 2, pos.x, pos.y - pointSize / 2,
				pos.x + pointSize / 2, pos.y + pointSize / 2 });
		break;
	case FILLED_TRIANGLE:
		graphics.fillPolygon(new int[] { pos.x - pointSize / 2,
				pos.y + pointSize / 2, pos.x, pos.y - pointSize / 2,
				pos.x + pointSize / 2, pos.y + pointSize / 2 });
		break;
	case SQUARE:
		graphics.drawRectangle(new Rectangle(pos.x - pointSize / 2, pos.y
				- pointSize / 2, pointSize, pointSize));
		break;
	case FILLED_SQUARE:
		graphics.fillRectangle(new Rectangle(pos.x - pointSize / 2, pos.y
				- pointSize / 2, pointSize, pointSize));
		break;
	case BAR:
		graphics.drawLine(pos.x, pos.y - pointSize / 2, pos.x, pos.y
				+ pointSize / 2);
		break;
	case CROSS:
		graphics.drawLine(pos.x, pos.y - pointSize / 2, pos.x, pos.y
				+ pointSize / 2);
		graphics.drawLine(pos.x - pointSize / 2, pos.y, pos.x + pointSize
				/ 2, pos.y);
		break;
	case XCROSS:
		graphics.drawLine(pos.x - pointSize / 2, pos.y - pointSize / 2,
				pos.x + pointSize / 2, pos.y + pointSize / 2);
		graphics.drawLine(pos.x + pointSize / 2, pos.y - pointSize / 2,
				pos.x - pointSize / 2, pos.y + pointSize / 2);
		break;
	case DIAMOND:
		graphics.drawPolyline(new int[] { pos.x, pos.y - pointSize / 2,
				pos.x - pointSize / 2, pos.y, pos.x, pos.y + pointSize / 2,
				pos.x + pointSize / 2, pos.y, pos.x, pos.y - pointSize / 2 });
		break;
	case FILLED_DIAMOND:
		graphics.fillPolygon(new int[] { pos.x, pos.y - pointSize / 2,
				pos.x - pointSize / 2, pos.y, pos.x, pos.y + pointSize / 2,
				pos.x + pointSize / 2, pos.y });
		break;
	default:
		break;
	}
	graphics.popState();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:74,代码来源:Trace.java


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