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


Java Arc2D.Float方法代碼示例

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


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

示例1: plotXY

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
public void plotXY( Graphics2D g,
			Rectangle2D bounds,
			double xScale, double yScale ) {
	g.setColor( Color.blue );
	float x0 = (float)bounds.getX();
	float y0 = (float)bounds.getY();
	float sy = (float)yScale;
	float sx = (float)xScale;
	Arc2D.Float arc = new Arc2D.Float(0f, 0f, 5f, 5f, 0f, 360f,
			Arc2D.CHORD);
	for(int k=0 ; k<xyd.length ; k++) {
		float x = (xyd[k][4]-x0)*sx;
		float y = (xyd[k][3]-y0)*sy;
		arc.x = x-2.5f;
		arc.y = y-2.5f;
		g.draw(arc);
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:19,代碼來源:D18oObservations.java

示例2: paintArc

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
private void paintArc(Graphics2D g,JComponent jc,float f,float w,float h,float multiplier,float angleOffset,float a) {
	float z = f*f*f*f;
	float r = f * w / 2f;
	float arcX = w/2f - r;
	float arcY = h/2f - r;
	float arcW = 2*r;
	float arcH = 2*r;
	float arcStart = (float)( multiplier*Math.sqrt(f)*360 + angleOffset );
	float arcExtent = (1-f)*(1-f)*360/3;
	
	Arc2D arc = new Arc2D.Float( arcX, arcY, arcW, arcH, arcStart, arcExtent, Arc2D.OPEN);
	g.setStroke(new BasicStroke(4*(1-z)));
	
	Color c = jc==null ? getDefaultForeground() : jc.getForeground();
	int alpha = (int)( 255*(1-f)*a );
	g.setColor(new Color( c.getRed(), c.getGreen(), c.getBlue(), Math.min(alpha, 255) ));
	g.draw(arc);
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:19,代碼來源:DetachingArcThrobberUI.java

示例3: drawTimerOnTrap

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/**
 * Draws a timer on a given trap.
 *
 * @param graphics
 * @param trap The trap on which the timer needs to be drawn
 * @param fill The fill color of the timer
 * @param border The border color of the timer
 * @param fillTimeLow The fill color of the timer when it is low
 * @param borderTimeLow The border color of the timer when it is low
 */
private void drawTimerOnTrap(Graphics2D graphics, HunterTrap trap, Color fill, Color border, Color fillTimeLow, Color borderTimeLow)
{
	net.runelite.api.Point loc = trap.getGameObject().getCanvasLocation();

	//Construct the arc
	Arc2D.Float arc = new Arc2D.Float(Arc2D.PIE);
	arc.setAngleStart(90);
	double timeLeft = 1 - trap.getTrapTimeRelative();
	arc.setAngleExtent(timeLeft * 360);
	arc.setFrame(loc.getX() - TIMER_SIZE / 2, loc.getY() - TIMER_SIZE / 2, TIMER_SIZE, TIMER_SIZE);

	//Draw the inside of the arc
	graphics.setColor(timeLeft > TIMER_LOW ? fill : fillTimeLow);
	graphics.fill(arc);

	//Draw the outlines of the arc
	graphics.setStroke(new BasicStroke(TIMER_BORDER_WIDTH));
	graphics.setColor(timeLeft > TIMER_LOW ? border : borderTimeLow);
	graphics.drawOval(loc.getX() - TIMER_SIZE / 2, loc.getY() - TIMER_SIZE / 2, TIMER_SIZE, TIMER_SIZE);
}
 
開發者ID:runelite,項目名稱:runelite,代碼行數:31,代碼來源:TrapOverlay.java

示例4: getDoorOrWindowSashShape

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/**
 * Returns the shape of a sash of a door or a window. 
 */
private GeneralPath getDoorOrWindowSashShape(HomeDoorOrWindow doorOrWindow, Sash sash)
{
	float modelMirroredSign = doorOrWindow.isModelMirrored() ? -1 : 1;
	float xAxis = modelMirroredSign * sash.getXAxis() * doorOrWindow.getWidth();
	float yAxis = sash.getYAxis() * doorOrWindow.getDepth();
	float sashWidth = sash.getWidth() * doorOrWindow.getWidth();
	float startAngle = (float) Math.toDegrees(sash.getStartAngle());
	if (doorOrWindow.isModelMirrored())
	{
		startAngle = 180 - startAngle;
	}
	float extentAngle = modelMirroredSign * (float) Math.toDegrees(sash.getEndAngle() - sash.getStartAngle());
	
	Arc2D arc = new Arc2D.Float(xAxis - sashWidth, yAxis - sashWidth, 2 * sashWidth, 2 * sashWidth, startAngle,
			extentAngle, Arc2D.PIE);
	AffineTransform transformation = AffineTransform.getTranslateInstance(doorOrWindow.getX(), doorOrWindow.getY());
	transformation.rotate(doorOrWindow.getAngle());
	transformation.translate(modelMirroredSign * -doorOrWindow.getWidth() / 2, -doorOrWindow.getDepth() / 2);
	PathIterator it = arc.getPathIterator(transformation);
	GeneralPath sashShape = new GeneralPath();
	sashShape.append(it, false);
	return sashShape;
}
 
開發者ID:valsr,項目名稱:SweetHome3D,代碼行數:27,代碼來源:PlanComponent.java

示例5: drawArc

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/** Calls <code>draw(Arc2D)</code>
 */
@Override
public void drawArc(int x, int y, int w, int h, int startAngle,
		int endAngle) {
	Arc2D a = new Arc2D.Float(x,y,w,h,startAngle,endAngle,Arc2D.OPEN);
	draw(a);
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:9,代碼來源:AbstractGraphics2D.java

示例6: fillArc

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/** Calls <code>fill(Arc2D)</code>
 */
@Override
public void fillArc(int x, int y, int w, int h, int startAngle,
		int endAngle) {
	Arc2D a = new Arc2D.Float(x,y,w,h,startAngle,endAngle,Arc2D.OPEN);
	fill(a);
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:9,代碼來源:AbstractGraphics2D.java

示例7: drawArc

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/**
 * Draws an arc.
 */
public void drawArc(int x, int y, int width, int height, int arcStart,
                    int arcAngle)
{
  ShapeCache sc = shapeCache;
  if (sc.arc == null)
    sc.arc = new Arc2D.Float();
  sc.arc.setArc(x, y, width, height, arcStart, arcAngle, Arc2D.OPEN);
  draw(sc.arc);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:13,代碼來源:AbstractGraphics2D.java

示例8: fillArc

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/**
 * Fills an arc.
 */
public void fillArc(int x, int y, int width, int height, int arcStart,
                    int arcAngle)
{
  ShapeCache sc = shapeCache;
  if (sc.arc == null)
    sc.arc = new Arc2D.Float();
  sc.arc.setArc(x, y, width, height, arcStart, arcAngle, Arc2D.PIE);
  draw(sc.arc);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:13,代碼來源:AbstractGraphics2D.java

示例9: MeterMarker

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/** Create a new ramp meter marker */
public MeterMarker() {
	super(4);
	float size = MARKER_SIZE_PIX;
	moveTo(0, 0);
	Arc2D.Float arc = new Arc2D.Float(0, -size, size, size,
		-90, 270, Arc2D.OPEN);
	append(arc, true);
	closePath();
	lineTo(size / 2, -size / 2);
}
 
開發者ID:CA-IRIS,項目名稱:ca-iris,代碼行數:12,代碼來源:MeterMarker.java

示例10: draw

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
public void draw(Graphics2D g) {
//	if(!display) return;
int yr1 = 1900;
int yr2 = 2005;
try {
	long[] interval = timeInterval();
	Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
	if( db.before.isSelected() ) {
			cal.setTimeInMillis(interval[0]);
			yr1 = cal.get(cal.YEAR);
	}
	if( db.after.isSelected() ) {
		cal.setTimeInMillis(interval[1]);
		yr2 = cal.get(cal.YEAR);
	}
} catch(Exception e) {
}
//	System.out.println( yr1 +"\t"+ yr2);
	float size = 2.0f + 6f/(float)map.getZoom();
	Arc2D.Float dot = new Arc2D.Float(-size/2f, -size/2f, size, size, 0f, 360f, Arc2D.CHORD);
	float size1 = 2.0f + 7f/(float)map.getZoom();
	GeneralPath triangle = new GeneralPath();
	triangle.moveTo(0f, size1/2f );
	triangle.lineTo(size1/2f, -size1/2f );
	triangle.lineTo(-size1/2f, -size1/2f );
	triangle.closePath();
//	Rectangle2D.Float square = new Rectangle2D.Float(-size1/2f, -size1/2f, size1, size1);
	AffineTransform at = g.getTransform();
	g.setStroke( new BasicStroke( .5f/(float)map.getZoom() ) );
	RenderingHints hints = g.getRenderingHints();
	g.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING,
			RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
	g.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
			RenderingHints.VALUE_ANTIALIAS_ON);

	Shape shape = dot;
	for(int k=0 ; k<xyd.length ; k++) {
	//	Shape shape = triangle;
	//	if( xyd[k][5]<=1991f ) shape = dot;
		if( xyd[k][5]>yr2 )continue;
		if( xyd[k][5]<yr1 )continue;
		g.translate( (double)xyd[k][0], (double)xyd[k][1] );
	//	g.setColor( Color.black );
	//	g.draw(shape);
		g.setColor( color[k] );
		g.fill(shape);
		g.setColor( Color.black );
		g.draw(shape);
		g.setTransform( at );
	}
	g.setFont( (new Font("Serif", Font.BOLD, 1)).deriveFont( size1*1.5f));
	Rectangle2D rect = map.getClipRect2D();
	double s = (double) size1;
	double x = rect.getX() + s;
	double y = rect.getY() + 2.*s;
//	g.translate( x, y );
//	g.setColor( Color.white );
//	g.fill( dot );
//	g.setColor( Color.black );
//	g.draw( dot );
//	g.translate( s, s/2.);
//	String year = db.startF.getText();
//	String dateString = db.before.isSelected()
//		? "before 1/1/"+year
//		: "after 1/1/"+year;
//	g.drawString( dateString, 0, 0);
//	g.drawString( "before 1/1/1991", 0, 0);
//	g.setTransform(at);
//	g.translate( x, y+s*2.0 );
//	g.setColor( Color.white );
//	g.fill( triangle );
//	g.setColor( Color.black );
//	g.draw( triangle );
//	g.translate( s, s/2.);
//	g.drawString( "after 1/1/1991", 0, 0);
	g.setTransform(at);
	g.setRenderingHints( hints);
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:79,代碼來源:D18oObservations.java

示例11: makeArc

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/** Make an arc */
static private Arc2D.Float makeArc(int s, int st, int ex) {
	return new Arc2D.Float(fscale(-s), fscale(-s),
		fscale(s * 2), fscale(s * 2), st, ex, Arc2D.OPEN);
}
 
開發者ID:CA-IRIS,項目名稱:ca-iris,代碼行數:6,代碼來源:TagReaderMarker.java

示例12: addButton

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/** Add a button to the marker */
protected void addButton(float w, float h) {
	Arc2D.Float arc = new Arc2D.Float(w - H24, h,
		H12, H12, 0, 360, Arc2D.OPEN);
	append(arc, false);
}
 
開發者ID:CA-IRIS,項目名稱:ca-iris,代碼行數:7,代碼來源:ControllerMarker.java

示例13: addCircle

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
protected void addCircle(float w, float h) {
	Arc2D.Float arc = new Arc2D.Float(w - H24, h - H24,
		H12, H12, 0, 360, Arc2D.OPEN);
	path.append(arc, false);
}
 
開發者ID:CA-IRIS,項目名稱:ca-iris,代碼行數:6,代碼來源:ControllerIcon.java

示例14: drawArc

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/**
 * Draws the outline of a circular or elliptical arc
 * covering the specified rectangle.
 * <p>
 * The resulting arc begins at <code>startAngle</code> and extends
 * for <code>arcAngle</code> degrees, using the current color.
 * Angles are interpreted such that 0&nbsp;degrees
 * is at the 3&nbsp;o'clock position.
 * A positive value indicates a counter-clockwise rotation
 * while a negative value indicates a clockwise rotation.
 * <p>
 * The center of the arc is the center of the rectangle whose origin
 * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the
 * <code>width</code> and <code>height</code> arguments.
 * <p>
 * The resulting arc covers an area
 * <code>width&nbsp;+&nbsp;1</code> pixels wide
 * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
 * <p>
 * The angles are specified relative to the non-square extents of
 * the bounding rectangle such that 45 degrees always falls on the
 * line from the center of the ellipse to the upper right corner of
 * the bounding rectangle. As a result, if the bounding rectangle is
 * noticeably longer in one axis than the other, the angles to the
 * start and end of the arc segment will be skewed farther along the
 * longer axis of the bounds.
 * @param        x the <i>x</i> coordinate of the
 *                    upper-left corner of the arc to be drawn.
 * @param        y the <i>y</i>  coordinate of the
 *                    upper-left corner of the arc to be drawn.
 * @param        width the width of the arc to be drawn.
 * @param        height the height of the arc to be drawn.
 * @param        startAngle the beginning angle.
 * @param        arcAngle the angular extent of the arc,
 *                    relative to the start angle.
 * @see         java.awt.Graphics#fillArc
 */
public void drawArc(int x, int y, int width, int height,
                    int startAngle, int arcAngle){
    Arc2D arc = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN);
    draw(arc);
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:43,代碼來源:AbstractGraphics2D.java

示例15: fillArc

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/**
 * Fills a circular or elliptical arc covering the specified rectangle.
 * <p>
 * The resulting arc begins at <code>startAngle</code> and extends
 * for <code>arcAngle</code> degrees.
 * Angles are interpreted such that 0&nbsp;degrees
 * is at the 3&nbsp;o'clock position.
 * A positive value indicates a counter-clockwise rotation
 * while a negative value indicates a clockwise rotation.
 * <p>
 * The center of the arc is the center of the rectangle whose origin
 * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the
 * <code>width</code> and <code>height</code> arguments.
 * <p>
 * The resulting arc covers an area
 * <code>width&nbsp;+&nbsp;1</code> pixels wide
 * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
 * <p>
 * The angles are specified relative to the non-square extents of
 * the bounding rectangle such that 45 degrees always falls on the
 * line from the center of the ellipse to the upper right corner of
 * the bounding rectangle. As a result, if the bounding rectangle is
 * noticeably longer in one axis than the other, the angles to the
 * start and end of the arc segment will be skewed farther along the
 * longer axis of the bounds.
 * @param        x the <i>x</i> coordinate of the
 *                    upper-left corner of the arc to be filled.
 * @param        y the <i>y</i>  coordinate of the
 *                    upper-left corner of the arc to be filled.
 * @param        width the width of the arc to be filled.
 * @param        height the height of the arc to be filled.
 * @param        startAngle the beginning angle.
 * @param        arcAngle the angular extent of the arc,
 *                    relative to the start angle.
 * @see         java.awt.Graphics#drawArc
 */
public void fillArc(int x, int y, int width, int height,
                    int startAngle, int arcAngle){
    Arc2D arc = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.PIE);
    fill(arc);
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:42,代碼來源:AbstractGraphics2D.java


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