/* */ package NET.worlds.console; /* */ /* */ import java.awt.Graphics; /* */ import java.awt.Polygon; /* */ import java.awt.Rectangle; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ class MoveablePolygon /* */ extends Polygon /* */ { /* */ private static final long serialVersionUID = 8800634603983512717L; /* */ private int xOffset; /* */ private int yOffset; /* 365 */ private Rectangle boundingBox = new Rectangle(); /* */ /* */ public MoveablePolygon() {} /* */ /* */ public MoveablePolygon(int[] xpoints, int[] ypoints) /* */ { /* 371 */ super(xpoints, ypoints, xpoints.length); /* */ } /* */ /* */ public void moveTo(int x, int y) { /* 375 */ if ((x != this.xOffset) || (y != this.yOffset)) { /* 376 */ int xdelta = x - this.xOffset; /* 377 */ int ydelta = y - this.yOffset; /* 378 */ this.xOffset = x; /* 379 */ this.yOffset = y; /* 380 */ for (int i = 0; i < this.npoints; i++) { /* 381 */ this.xpoints[i] += xdelta; /* 382 */ this.ypoints[i] += ydelta; /* */ } /* */ } /* */ } /* */ /* */ public void drawFilled(Graphics g, int x, int y) { /* 388 */ moveTo(x, y); /* 389 */ g.fillPolygon(this); /* */ } /* */ /* */ /* */ /* */ /* */ public Rectangle getBoundingBox() /* */ { /* 397 */ int boundsMinX = Integer.MAX_VALUE; /* 398 */ int boundsMinY = Integer.MAX_VALUE; /* 399 */ int boundsMaxX = Integer.MIN_VALUE; /* 400 */ int boundsMaxY = Integer.MIN_VALUE; /* */ /* 402 */ for (int i = 0; i < this.npoints; i++) { /* 403 */ int x = this.xpoints[i]; /* 404 */ boundsMinX = Math.min(boundsMinX, x); /* 405 */ boundsMaxX = Math.max(boundsMaxX, x); /* 406 */ int y = this.ypoints[i]; /* 407 */ boundsMinY = Math.min(boundsMinY, y); /* 408 */ boundsMaxY = Math.max(boundsMaxY, y); /* */ } /* 410 */ this.boundingBox.setBounds(boundsMinX, boundsMinY, boundsMaxX - boundsMinX, /* 411 */ boundsMaxY - boundsMinY); /* 412 */ return this.boundingBox; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\MoveablePolygon.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */