* <code>getImgPos(...)</code>.
*
* @return An image view of the current environment state.
*/
public synchronized BufferedImage getOutsideView(Graphics2D g2) {
Rectangle2D visibleBox;
if (this.isPerfectFit() && this.zoomBox == null) {
this.createBoundingBox();
}
if (this.redrawField) {
this.field = new BufferedImage(
(int) this.screenWidth,
(int) this.screenHeight,
BufferedImage.TYPE_4BYTE_ABGR);
} else {
return this.field;
}
visibleBox = this.getCurrentViewBox();
Graphics2D g;
if (g2 == null) {
g = this.field.createGraphics();
} else {
g = g2;
}
Polygon2D shape;
int id;
g.setBackground(this.backgroundColor);
g.clearRect(0, 0, this.field.getWidth(), this.field.getHeight());
double globalScale = this.globalScale();
Polygon2D b = visibleBox.toPol2D();
b.scale(Vector2D.NULL_VECTOR, new Vector2D(globalScale, globalScale));
Vector2D midTranslation = new Vector2D(screenWidth / 2, screenHeight / 2);
midTranslation.sub(b.centerPoint());
Rectangle2D border = new Rectangle2D(
new Vector2D(screenLeft, screenUp),
new Vector2D(screenWidth - screenLeft, screenHeight - screenUp));
Polygon2D bound = visibleBox.toPol2D();
bound.scale(Vector2D.NULL_VECTOR, new Vector2D(globalScale, globalScale));
bound.translate(midTranslation);
g.setColor(Color.red);
g.drawPolygon(border.toPol());
if (this.pars.getParValueBoolean("PaintPinkBoundingBox?")) {
g.setColor(Color.pink);
g.drawPolygon(bound.toPol());
g.drawString(
visibleBox.upperLeftCorner().toString(),
(int) bound.getBoundingBox().upperLeftCorner().x,
(int) bound.getBoundingBox().upperLeftCorner().y - 10);
String rechtsunten = visibleBox.lowerRightCorner().toString();
g.drawString(
rechtsunten,
(int) Math.min(bound.getBoundingBox().lowerRightCorner().x,
this.screenWidth - rechtsunten.length() * 8),
(int) bound.getBoundingBox().lowerRightCorner().y + 20);
}
Rectangle2D clip = this.getClippingRectangle();
g.clipRect(
(int) clip.upperLeftCorner().x,
(int) clip.upperLeftCorner().y,
(int) clip.lowerRightCorner().x,
(int) clip.lowerRightCorner().y);
Rectangle2D visibleRedBox = new Rectangle2D(
// visibleBox.liObEcke(),
this.getRealPosFromScreenPos(new Vector2D(0, 0)),
// visibleBox.rechtUntEcke(),
this.getRealPosFromScreenPos(new Vector2D(screenWidth, screenHeight)));