From aadace1285c17d780eceec8666edd06bdeb95f9a Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 1 Nov 2005 00:49:13 +0000 Subject: [PATCH] fixed network image in search performance monitor git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1012 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/plasma/plasmaGrafics.java | 3 ++- source/de/anomic/ymage/ymageMatrix.java | 23 ++++++++++++------- .../de/anomic/ymage/ymageMatrixPainter.java | 4 ++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/source/de/anomic/plasma/plasmaGrafics.java b/source/de/anomic/plasma/plasmaGrafics.java index d2217d63d..06b4aa1cb 100644 --- a/source/de/anomic/plasma/plasmaGrafics.java +++ b/source/de/anomic/plasma/plasmaGrafics.java @@ -72,7 +72,8 @@ public class plasmaGrafics { if (searches == null) return null; // this was a local search and there are no threads // get a copy of a recent network picture - ymagePainter eventPicture = (ymagePainter) getNetworkPicture(120000).clone(); + ymagePainter eventPicture = getNetworkPicture(120000); + if (eventPicture instanceof ymageMatrixPainter) eventPicture = new ymageMatrixPainter((ymageMatrix) eventPicture); // get dimensions int cr = Math.min(eventPicture.getWidth(), eventPicture.getHeight()) / 5 - 20; diff --git a/source/de/anomic/ymage/ymageMatrix.java b/source/de/anomic/ymage/ymageMatrix.java index 55c5f68a5..4bdd66b4f 100644 --- a/source/de/anomic/ymage/ymageMatrix.java +++ b/source/de/anomic/ymage/ymageMatrix.java @@ -72,6 +72,19 @@ public class ymageMatrix implements Cloneable { private byte defaultMode; private boolean grabComplementary = false; + public ymageMatrix(ymageMatrix matrix) { + // clones the matrix + this.width = matrix.width; + this.height = matrix.height; + this.defaultColR = matrix.defaultColR; + this.defaultColG = matrix.defaultColG; + this.defaultColB = matrix.defaultColB; + this.defaultMode = matrix.defaultMode; + this.grabComplementary = matrix.grabComplementary; + this.grid = new byte[3 * width * height]; + System.arraycopy(matrix.grid, 0, this.grid, 0, matrix.grid.length); + } + public ymageMatrix(int width, int height, String backgroundColor) { this(width, height, colNum(backgroundColor)); } @@ -83,7 +96,7 @@ public class ymageMatrix implements Cloneable { this.defaultColG = 0xFF; this.defaultColB = 0xFF; this.defaultMode = MODE_REPLACE; - grid = new byte[3*width*height]; + grid = new byte[3 * width * height]; // fill grid with background color byte bgR = (byte) (backgroundColor >> 16); @@ -108,13 +121,7 @@ public class ymageMatrix implements Cloneable { } public Object clone() { - ymageMatrix ip = new ymageMatrix(this.width, this.height, 0); - System.arraycopy(this.grid, 0, ip.grid, 0, this.grid.length); - ip.defaultColR = this.defaultColR; - ip.defaultColG = this.defaultColG; - ip.defaultColB = this.defaultColB; - ip.defaultMode = this.defaultMode; - return ip; + return new ymageMatrix(this); } public int getWidth() { diff --git a/source/de/anomic/ymage/ymageMatrixPainter.java b/source/de/anomic/ymage/ymageMatrixPainter.java index 6fd8b4fd7..793011b39 100644 --- a/source/de/anomic/ymage/ymageMatrixPainter.java +++ b/source/de/anomic/ymage/ymageMatrixPainter.java @@ -66,6 +66,10 @@ public class ymageMatrixPainter extends ymageMatrix implements ymagePainter { super(width, height, backgroundColor); } + public ymageMatrixPainter(ymageMatrix matrix) { + super(matrix); + } + private static int[] getCircleCoords(int radius) { if ((radius - 1) < circles.length) return circles[radius - 1];