From 0da6e947c69891953eb7973d95f542f73711e451 Mon Sep 17 00:00:00 2001 From: ctrebeau <ctrebeau@pasteur.fr> Date: Fri, 30 Oct 2020 14:39:47 +0100 Subject: [PATCH] Bug fixed : the number of point is based on the actual content of the 2D array and not on the number of Coordinates objects created. --- .../zellige/jzy3D/LocalMaximumsDisplay.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/pasteur/ida/zellige/jzy3D/LocalMaximumsDisplay.java b/src/main/java/fr/pasteur/ida/zellige/jzy3D/LocalMaximumsDisplay.java index 098b025c..6dcf151e 100644 --- a/src/main/java/fr/pasteur/ida/zellige/jzy3D/LocalMaximumsDisplay.java +++ b/src/main/java/fr/pasteur/ida/zellige/jzy3D/LocalMaximumsDisplay.java @@ -26,8 +26,9 @@ public class LocalMaximumsDisplay extends AbstractAnalysis { if ( maximumCoordinates != null ) { - Coord3d[] points = new Coord3d[ Coordinate.number ]; - Color[] colors = new Color[ Coordinate.number ]; + int length = getNumberOfCoordinates(); + Coord3d[] points = new Coord3d[ length ]; + Color[] colors = new Color[ length ]; int x; int y; @@ -46,7 +47,7 @@ public class LocalMaximumsDisplay extends AbstractAnalysis { Coordinate pixel = pixels.get(0); x = pixel.getX(); y = pixel.getY(); - z = pixel .getZ(); + z = pixel.getZ(); points[ index ] = new Coord3d( x, y, z ); colors[ index ] = Color.BLACK; index++; @@ -73,4 +74,20 @@ public class LocalMaximumsDisplay extends AbstractAnalysis chart.getScene().add( scatter ); } } + + private int getNumberOfCoordinates() + { + int n = 0; + for ( int i = 0; i <= maximumCoordinates[0].length - 1; i++ ) + { + for ( int j = 0; j <= maximumCoordinates.length - 1 ; j++ ) + { + if( maximumCoordinates[i][j] != null) + { + n += maximumCoordinates[i][j].size(); + } + } + } + return n; + } } -- GitLab