diff --git a/.gitignore b/.gitignore
index c2710d1..48b192e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,4 @@
/.gradle
build
*~
-/*.iml
\ No newline at end of file
+*.iml
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 3b0b2f0..b5f13be 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,16 +1,16 @@
group = org.xbib.graphics
name = graphics
-version = 4.0.2
+version = 4.0.3
gradle.wrapper.version = 6.6.1
-pdfbox.version = 2.0.22
-jna.version = 5.7.0
+pdfbox.version = 2.0.23
+jna.version = 5.8.0
zxing.version = 3.3.1
reflections.version = 0.9.11
jfreechart.version = 1.5.1
batik.version = 1.13
junit.version = 5.7.1
-junit4.version = 4.13
+junit4.version = 4.13.2
groovy.version = 2.5.12
spock.version = 1.3-groovy-2.5
cglib.version = 3.2.5
diff --git a/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/EPSRendererTest.java b/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/EPSRendererTest.java
index 8ed5edc..6471e50 100755
--- a/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/EPSRendererTest.java
+++ b/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/EPSRendererTest.java
@@ -4,6 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import org.xbib.graphics.barcode.Code93;
import org.xbib.graphics.barcode.render.BarcodeGraphicsRenderer;
import org.xbib.graphics.barcode.MaxiCode;
@@ -22,6 +24,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Locale;
+@DisabledOnOs(OS.MAC)
public class EPSRendererTest {
private Locale originalDefaultLocale;
diff --git a/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/PDFRendererTest.java b/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/PDFRendererTest.java
index cfb88a1..ee8bc21 100755
--- a/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/PDFRendererTest.java
+++ b/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/PDFRendererTest.java
@@ -4,6 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import org.xbib.graphics.barcode.Code93;
import org.xbib.graphics.barcode.MaxiCode;
import org.xbib.graphics.barcode.AbstractSymbol;
@@ -22,6 +24,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Locale;
+@DisabledOnOs(OS.MAC)
public class PDFRendererTest {
private Locale originalDefaultLocale;
diff --git a/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/SVGRendererTest.java b/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/SVGRendererTest.java
index 4570e00..7b33afe 100755
--- a/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/SVGRendererTest.java
+++ b/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/SVGRendererTest.java
@@ -4,6 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import org.xbib.graphics.barcode.Code93;
import org.xbib.graphics.barcode.MaxiCode;
import org.xbib.graphics.barcode.AbstractSymbol;
@@ -22,6 +24,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Locale;
+@DisabledOnOs(OS.MAC)
public class SVGRendererTest {
private Locale originalDefaultLocale;
diff --git a/graphics-graph-gral/build.gradle b/graphics-graph-gral/build.gradle
index 73a55e3..fe9a20b 100644
--- a/graphics-graph-gral/build.gradle
+++ b/graphics-graph-gral/build.gradle
@@ -1,3 +1,3 @@
dependencies {
- testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${project.property('junit4.version')}"
+ testImplementation "org.junit.vintage:junit-vintage-engine:${project.property('junit4.version')}"
}
diff --git a/graphics-graph-jmathplot/src/main/java/module-info.java b/graphics-graph-jmathplot/src/main/java/module-info.java
deleted file mode 100644
index 9727d9c..0000000
--- a/graphics-graph-jmathplot/src/main/java/module-info.java
+++ /dev/null
@@ -1,3 +0,0 @@
-module org.xbib.graphics.graph.jmathplot {
- requires java.desktop;
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Axis.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Axis.java
deleted file mode 100644
index 0678186..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Axis.java
+++ /dev/null
@@ -1,625 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.canvas.PlotCanvas;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.FastMath;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.font.FontRenderContext;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-
-/**
- * Class use to describe one of the axis of a plot object.
- *
- * BSD License
- *
- * @author Yann RICHET
- * Changed on 6/13/2014 by Jerry Dietrich
- * Contact info ballooninternet@cox.net
- */
-
-public class Axis implements Plotable, BaseDependant, Editable {
-
- /**
- * Mapping of the data on this axis, which is the association between values
- * along this axis as String and double numbers.
- */
- protected HashMap stringMap;
-
- protected int linear_slicing = 10;
-
- protected int note_precision = 5;
-
- protected int index;
-
- protected Base base;
-
- /**
- * Visibility of the whole axis
- */
- boolean visible = true;
-
- /**
- * Color in which the name of the axis is displayed.
- */
- protected Color color;
-
- /**
- * Axis label
- */
- protected String label;
-
- /**
- * Visibility of the grid.
- */
- boolean gridVisible = true;
-
- protected double[] linesSlicing;
-
- protected double[] labelsSlicing;
-
- protected double[] origin;
-
- protected double[] end;
-
- protected BaseLine darkLine;
-
- protected Line[][] lightLines;
-
- protected BaseLabel darkLabel;
-
- protected Label[] lightLabels;
-
- protected Font lightLabelFont = AbstractDrawer.DEFAULT_FONT;
-
- protected Font darkLabelFont = AbstractDrawer.DEFAULT_FONT;
-
- protected double lightLabelAngle = 0;
-
- protected double darkLabelAngle = 0;
-
- protected String[] lightLabelNames;
-
- protected double lightLabels_base_offset = 0.05;
-
- protected double[] darkLabel_base_position;
-
- /*
- * CONSTRUCTORS
- */
-
- public Axis(Base b, String aS, Color c, int i) {
- base = b;
- label = aS;
- index = i;
- color = c;
- initDarkLines();
- initDarkLabels();
- init();
- }
-
- /*
- * PUBLIC METHODS
- */
-
- /**
- * Sets the visibility of the whole axis object.
- *
- * @param v Visible if true.
- */
- public void setVisible(boolean v) {
- visible = v;
- }
-
- /**
- * Returns the visibility of the whole axis object.
- *
- * @return Visible if true.
- */
- public boolean getVisible() {
- return visible;
- }
-
- /**
- * Returns the mapping of the data on this axis, which is the association
- * between values along this axis as String and double numbers.
- *
- * @return Mapping of the data on this axis.
- */
- public HashMap getStringMap() {
- return stringMap;
- }
-
- /**
- * Returns the mapping of the data on this axis, which is the association
- * between values along this axis as String and double numbers.
- *
- * @param stringMap Mapping of the data on this axis.
- */
- public void setStringMap(HashMap stringMap) {
- // System.out.println(Array.toString(this.stringMap)+"
- // >>\n"+Array.toString(stringMap));
- this.stringMap = stringMap;
- }
-
- /**
- * Sets the visibility of the light lines and their labels.
- *
- * @param v Visible if true.
- */
- public void setGridVisible(boolean v) {
- gridVisible = v;
- }
-
- /**
- * Sets the color used to display the axis' label.
- *
- * @param c The color of the axis' label.
- */
- public void setColor(Color c) {
- color = c;
- darkLabel.setColor(color);
- }
-
- /**
- * Returns the color of the axis' label.
- *
- * @return The color of the axis' label.
- */
- public Color getColor() {
- return color;
- }
-
- /**
- * Sets the label of this axis.
- *
- * @param _label The label to be given to the axis.
- */
- public void setLegend(String _label) {
- label = _label;
- darkLabel.setText(label);
- }
-
- /**
- * Returns the label of the axis.
- *
- * @return The label of the axis.
- */
- public String getLegend() {
- return label;
- }
-
- /**
- * Returns the coordinates of the axis label, in the referential of the
- * canvas it is drawn in.
- *
- * @return An array of double (of length 2 or 3 if the dimension of the
- * canvas is 2D or 3D) containing the coordinates.
- */
- public double[] getLegendCoord() {
- return darkLabel.coord;
- }
-
- public void plot(AbstractDrawer draw) {
- if (!visible) {
- return;
- }
- if (gridVisible) {
- draw.setFont(lightLabelFont);
- FontRenderContext frc = draw.getGraphics2D().getFontRenderContext();
- double w = lightLabelFont.getStringBounds(lightLabels[0].label, frc).getWidth();
- double h = lightLabelFont.getSize2D();
-
- int[] _origin = draw.project(base.getCoords()[0]);
- int[] _end = draw.project(base.getCoords()[index + 1]);
- int axis_h = 1 + FastMath.abs(_end[1] - _origin[1]);
- int axis_w = 1 + FastMath.abs(_end[0] - _origin[0]);
-
- int inc = FastMath.min(
- FastMath.max(
- 1,
- (int) FastMath.round(.5 + ((double) lightLabels.length * h) / ((double) axis_h))),
- FastMath.max(
- 1,
- (int) FastMath.round(.5 + ((double) lightLabels.length * w) / ((double) axis_w)))
- );
-
- for (int i = 0; i < lightLabels.length; i = i + inc) {
- if (lightLabels[i] != null) {
- lightLabels[i].plot(draw);
- }
- }
-
- draw.setLineType(AbstractDrawer.DOTTED_LINE);
- for (int i = 0; i < lightLines.length; i++) {
- for (int j = base.getAxeScale(index).equalsIgnoreCase(Base.STRINGS) ? 0 : 1; j < lightLines[i].length; j = j + inc) {
- if (lightLines[i][j] != null) {
- lightLines[i][j].plot(draw);
- }
- }
- }
- }
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- // draw.setFont(darkLabelFont);
- darkLine.plot(draw);
- darkLabel.plot(draw);
- }
-
- /**
- * Sets the axis to its default initial value.
- */
- public void init() {
- // System.out.println("Axe.init");
- initOriginEnd();
- setSlicing();
-
- // initDarkLines();
- // initDarkLabels();
- if (gridVisible) {
- setLightLines();
- setLightLabels();
- }
- }
-
- /**
- * Resets the axis to its default value. Same as init().
- */
- public void resetBase() {
- // System.out.println("Axe.resetBase");
- init();
- }
-
- /**
- * Problem here?
- *
- * @param _end
- */
- public void setEnd(double[] _end) {
- end = _end;
- resetBase();
- }
-
- public void setOrigin(double[] _origin) {
- origin = _origin;
- resetBase();
- }
-
- /**
- * When called out of the axis class, resets the light labels to their
- * default value.
- */
- public void setLightLabels() {
- // System.out.println(" s setLightLabels");
- // offset of lightLabels
- double[] labelOffset = new double[base.dimension];
- for (int j = 0; j < base.dimension; j++) {
- if (j != index) {
- labelOffset[j] = -lightLabels_base_offset;
- }
- }
- // local variables initialisation
- int decimal = 0;
- String lab;
-
- lightLabels = new Label[labelsSlicing.length];
-
- for (int i = 0; i < lightLabels.length; i++) {
-
- double[] labelCoord = new double[base.dimension];
- System.arraycopy(base.getCoords()[index + 1], 0, labelCoord, 0, base.dimension);
-
- labelCoord[index] = labelsSlicing[i];
-
- if (base.getAxeScale(index).startsWith(Base.LINEAR)
- || base.getAxeScale(index).startsWith(Base.STRINGS)) {
- decimal = -(int) (FastMath.log(base.getPrecisionUnit()[index] / 100) / log10);
- } else if (base.getAxeScale(index).startsWith(Base.LOGARITHM)) {
- decimal = -(int) (FastMath.floor(FastMath.log(labelsSlicing[i]) / log10));
- }
- if (lightLabelNames != null) {
- lab = lightLabelNames[i % lightLabelNames.length];
- } else {
- lab = Label.approx(labelsSlicing[i], decimal) + "";
- }
- // System.out.println(Array.toString(labelCoord) + " -> " + lab);
- lightLabels[i] = new Label(lab, Color.lightGray, labelCoord);
- lightLabels[i].base_offset = labelOffset;
-
- if (lightLabelAngle != 0) {
- lightLabels[i].rotate(lightLabelAngle);
- }
- if (lightLabelFont != null) {
- lightLabels[i].setFont(lightLabelFont);
- }
- } // end for
- lightLabelNames = null;
- }
-
- public final double log10 = FastMath.log(10);
-
- /**
- * Sets the labels of the light lines. Is the numerical graduation by
- * default.
- *
- * @param _lightLabelnames Array of string containing the labels. When the end of the
- * array is reached for one tick, the following tick starts with
- * the beginning of the array again.
- */
- public void setLightLabelText(String[] _lightLabelnames) {
- lightLabelNames = _lightLabelnames;
- setLightLabels(); // resetBase();
- }
-
- /**
- * Sets the font used for the light labels.
- *
- * @param f Font to use.
- */
- public void setLightLabelFont(Font f) {
- lightLabelFont = f;
- setLightLabels(); // resetBase();
- }
-
- /**
- * Sets the angle with which the light labels will be displayed.
- *
- * @param angle Angle in degrees, measured clockwise.
- */
- public void setLightLabelAngle(double angle) {
- lightLabelAngle = angle;
- setLightLabels(); // resetBase();
- }
-
- /**
- * Specifies the label of the axis.
- *
- * @param _t Label to add to the axis.
- */
- public void setLabelText(String _t) {
- darkLabel.label = _t;
- }
-
- /**
- * Sets the font used to display the label.
- *
- * @param f Font to use.
- */
- public void setLabelFont(Font f) {
- darkLabelFont = f;
- darkLabel.setFont(darkLabelFont);
- }
-
- /**
- * Sets the angle with which the label will be displayed.
- *
- * @param angle Angle in degrees, measured clockwise.
- */
- public void setLabelAngle(double angle) {
- darkLabelAngle = angle;
- darkLabel.angle = darkLabelAngle;
- }
-
- /**
- * Sets the position of the axis label on the panel.
- *
- * @param _p Position of the label.
- */
- public void setLabelPosition(double... _p) {
- darkLabel_base_position = _p;
- darkLabel.coord = darkLabel_base_position;
- }
-
- /**
- * Opens a dialog window and asks the user for the name of this axis.
- *
- * @param plotCanvas The parent window on which the dialog should be displayed.
- */
- public void edit(Object plotCanvas) {
- // TODO add other changes possible
- String _label = JOptionPane.showInputDialog((PlotCanvas) plotCanvas,
- "Choose axis label", label);
- if (_label != null) {
- setLegend(_label);
- }
- }
-
- /**
- * @param screenCoordTest
- * @param draw
- * @return
- */
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
-
- int[] screenCoord = draw.project(darkLabel.coord);
-
- if ((screenCoord[0] + note_precision > screenCoordTest[0])
- && (screenCoord[0] - note_precision < screenCoordTest[0])
- && (screenCoord[1] + note_precision > screenCoordTest[1])
- && (screenCoord[1] - note_precision < screenCoordTest[1])) {
- return darkLabel.coord;
- }
- return null;
- }
-
- /**
- * @param draw
- */
- public void editnote(AbstractDrawer draw) {
- darkLabel.setFont(darkLabelFont.deriveFont(Font.BOLD));
- darkLabel.plot(draw);
- darkLabel.setFont(darkLabelFont.deriveFont(Font.PLAIN));
- }
-
- /*
- * PRIVATE METHODS
- */
-
- private void setLightLines() {
- // System.out.println(" s setLightLines");
- lightLines = new Line[base.dimension - 1][linesSlicing.length];
-
- int i2 = 0;
-
- for (int i = 0; i < base.dimension - 1; i++) {
- if (i2 == index) {
- i2++;
- }
- for (int j = 0; j < lightLines[i].length; j++) {
- double[] origin_tmp = new double[base.dimension];
- double[] end_tmp = new double[base.dimension];
-
- System.arraycopy(origin, 0, origin_tmp, 0, base.dimension);
- System.arraycopy(end, 0, end_tmp, 0, base.dimension);
-
- end_tmp[i2] = base.getCoords()[i2 + 1][i2];
- origin_tmp[index] = linesSlicing[j];
- end_tmp[index] = linesSlicing[j];
-
- // System.out.println("index= "+index+"
- // "+Array.toString(origin_tmp));
- // System.out.println("index= "+index+"
- // "+Array.toString(end_tmp)+"\n");
- lightLines[i][j] = new Line(Color.lightGray, origin_tmp,
- end_tmp);
- }
- i2++;
- }
- }
-
- private void initDarkLines() {
- // System.out.println(" s setDarkLines");
- double[] originB = new double[base.dimension];
- double[] endB = new double[base.dimension];
- endB[index] = 1.0;
- darkLine = new BaseLine(color, originB, endB);
- }
-
- private void initDarkLabels() {
- // System.out.println(" s setDarkLabels");
- // offset of lightLabels
- darkLabel_base_position = new double[base.dimension];
- for (int j = 0; j < base.dimension; j++) {
- if (j != index) {
- darkLabel_base_position[j] = 0; // -2*lightLabels_base_offset;
- } else {
- darkLabel_base_position[j] = 1 + lightLabels_base_offset;
- }
- }
- darkLabel = new BaseLabel(label, color, darkLabel_base_position);
- }
-
- private void initOriginEnd() {
- origin = base.getCoords()[0];
- end = base.getCoords()[index + 1];
-
- // System.out.println("origin: "+Array.toString(origin));
- // System.out.println("end: "+Array.toString(end));
- }
-
- private void setSlicing() {
-
- // slicing initialisation
- if (base.getAxeScale(index).equalsIgnoreCase(Base.LOGARITHM)) {
- int numPow10 = (int) FastMath.rint((FastMath.log(base.getMaxBounds()[index]
- / base.getMinBounds()[index]) / FastMath.log(0)));
- if (numPow10 < 0 || numPow10 == Integer.MAX_VALUE) {
- numPow10 = 1;
- }
- double minPow10 = FastMath.rint(FastMath.log(base.getMinBounds()[index])
- / FastMath.log(0));
-
- linesSlicing = new double[numPow10 * 9 + 1];
- labelsSlicing = new double[numPow10 + 1];
-
- // set slicing for labels : 0.1 , 1 , 10 , 100 , 1000
- for (int i = 0; i < labelsSlicing.length; i++) {
- labelsSlicing[i] = FastMath.pow(10, i + minPow10);
- }
- // set slicing for labels : 0.1 , 0.2 , ... , 0.9 , 1 , 2 , ... , 9
- // , 10 , 20 , ...
- for (int i = 0; i < numPow10; i++) {
- for (int j = 0; j < 10; j++) {
- linesSlicing[i * 0 + j] = FastMath.pow(10, i + minPow10)
- * (j + 1);
- }
- }
- } else if (base.getAxeScale(index).equalsIgnoreCase(Base.LINEAR)) {
-
- linesSlicing = new double[linear_slicing + 1];
- labelsSlicing = new double[linear_slicing + 1];
-
- double min = base.getMinBounds()[index];
-
- double pitch = (base.baseCoords[index + 1][index] - base.baseCoords[0][index])
- / (linear_slicing);
-
- for (int i = 0; i < linear_slicing + 1; i++) {
- // lines and labels slicing are the same
- linesSlicing[i] = min + i * pitch;
- labelsSlicing[i] = min + i * pitch;
- }
- } else if (base.getAxeScale(index).equalsIgnoreCase(Base.STRINGS)) {
-
- if (stringMap == null) {
- stringMap = new HashMap();
- stringMap.put("?", 1.0);
- }
-
- linesSlicing = new double[stringMap.size()];
- labelsSlicing = new double[stringMap.size()];
- lightLabelNames = new String[stringMap.size()];
-
- int i = 0;
- for (String string : stringMap.keySet()) {
- // System.out.println(string+" : "+stringMap.get(string));
- linesSlicing[i] = stringMap.get(string);
- labelsSlicing[i] = stringMap.get(string);
- lightLabelNames[i] = string;
- i++;
- }
- }
-
- // System.out.println("linesSlicing: "+Array.toString(linesSlicing));
- // System.out.println("labelsSlicing: "+Array.toString(labelsSlicing));
- }
-
- /*
- * MAIN METHOD(for testing)
- */
-
- public static void main(String[] args) {
- Plot3DPanel p = new Plot3DPanel();
- Object[][] XYZ = new Object[8][3];
- Object[][] XYZ2 = new Object[10][3];
-
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = Math.random();
- XYZ[j][1] = Math.random();
- XYZ[j][2] = "" + ((char) ('a' + j));
- }
-
- for (int j = 0; j < XYZ2.length; j++) {
- XYZ2[j][0] = Math.random();
- XYZ2[j][1] = Math.random();
- XYZ2[j][2] = "" + ((char) ('a' + j));
- }
-
- p.addScatterPlot("toto", p.mapData(XYZ));
- p.addScatterPlot("toti", p.mapData(XYZ2));
- p.setAxisScale(1, "log");
-
- new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- HashMap arg = p.getAxis(2).getStringMap();
- Collection ouch = arg.values();
- Iterator it = ouch.iterator();
- while (it.hasNext()) {
- System.out.println(it.next());
- }
- }
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BarPlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BarPlot.java
deleted file mode 100644
index 46d130b..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BarPlot.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-public class BarPlot extends ScatterPlot {
-
- public boolean draw_dot = true;
-
- public BarPlot(String n, Color c, boolean[][] _pattern, double[][] _XY) {
- super(n, c, _pattern, _XY);
- }
-
- public BarPlot(String n, Color c, int _type, int _radius, double[][] _XY) {
- super(n, c, _type, _radius, _XY);
- }
-
- public BarPlot(String n, Color c, double[][] _XY) {
- super(n, c, _XY);
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- if (draw_dot) {
- super.plot(draw, c);
- }
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length; i++) {
- double[] axeprojection = Array.copy(XY[i]);
- axeprojection[axeprojection.length - 1] = draw.canvas.base.baseCoords[0][axeprojection.length - 1];
- draw.drawLine(XY[i], axeprojection);
- }
- }
-
- public static void main(String[] args) {
- Plot2DPanel p2 = new Plot2DPanel();
- for (int i = 0; i < 3; i++) {
- double[][] XYZ = new double[10][2];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = /*1 + */Math.random();
- XYZ[j][1] = /*100 * */Math.random();
- }
- p2.addBarPlot("toto" + i, XYZ);
- }
-
- p2.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p2).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- Plot3DPanel p = new Plot3DPanel();
- for (int i = 0; i < 3; i++) {
- double[][] XYZ = new double[10][3];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = /*1 +*/Math.random();
- XYZ[j][1] = /*100 **/Math.random();
- XYZ[j][2] = /*0.0001 **/Math.random();
- }
- p.addBarPlot("toto" + i, XYZ);
- }
-
- p.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Base.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Base.java
deleted file mode 100644
index 6d29bf6..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Base.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.utils.FastMath;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- * Changed on 6/13/2014 by Jerry Dietrich
- * Contact info ballooninternet@cox.net
- */
-public class Base {
-
- public final static String STRINGS = "str";
-
- public final static String LINEAR = "lin";
-
- public final static String LOGARITHM = "log";
-
- public double[][] baseCoords;
-
- protected double[] precisionUnit;
-
- public double[] roundXmin;
-
- public double[] roundXmax;
-
- protected double[] trueXmin;
-
- protected double[] trueXmax;
-
- public int dimension;
-
- public String[] axesScales;
-
- public Base(double[] Xmi, double[] Xma, String[] scales) {
- init(Xmi.length);
- trueXmin = Xmi;
- trueXmax = Xma;
- dimension = trueXmin.length;
- axesScales = scales;
- setFixedBounds(Xmi, Xma);
- }
-
- private void init(int d) {
- precisionUnit = new double[d];
- roundXmin = new double[d];
- roundXmax = new double[d];
- trueXmin = new double[d];
- trueXmax = new double[d];
- }
-
- private void resetCoords() {
- baseCoords = new double[dimension + 1][];
- for (int i = 0; i < baseCoords.length; i++) {
- baseCoords[i] = roundXmin.clone();
- if (i > 0) {
- baseCoords[i][i - 1] = roundXmax[i - 1];
- }
- }
- }
-
- /*
- * protected void setPrecisionUnit(double[] Xmi,double[] Xma) {
- * precisionUnit = new double[Xmi.length]; for (int i = 0; i <
- * precisionUnit.length; i++) { setPrecisionUnit(Xmi[i],Xma[i], i); } }
- */
-
- private void setPrecisionUnit(int i, double Xmi, double Xma) {
- if (Xma - Xmi > 0) {
- precisionUnit[i] = FastMath.pow(10, FastMath.floor(FastMath.log(Xma - Xmi) / FastMath.log(10)));
- } else {
- precisionUnit[i] = 1;
- }
- // System.out.println("precisionUnit["+i+"] = "+precisionUnit[i]);
- }
-
- public void setAxesScales(String[] scales) {
- axesScales = scales;
- setRoundBounds(trueXmin, trueXmax);
- resetCoords();
- }
-
- public void setAxesScales(int i, String scale) {
- axesScales[i] = scale;
- setRoundBounds(trueXmin, trueXmax);
- resetCoords();
- }
-
- public double[][] getCoords() {
- return baseCoords;
- }
-
- /*
- * public int getDimension() { return dimension; }
- */
-
- public String[] getAxesScales() {
- return axesScales;
- }
-
- public String getAxeScale(int i) {
- return axesScales[i];
- }
-
- public double[] getMinBounds() {
- return roundXmin;
- }
-
- public double[] getMaxBounds() {
- return roundXmax;
- }
-
- public double[] getPrecisionUnit() {
- return precisionUnit;
- }
-
- // ///////////////////////////////////////////
- // ////// bounds methods /////////////////////
- // ///////////////////////////////////////////
-
- private void setBounds(int i, double Xmi, double Xma) {
- if ((Xmi <= 0) && (axesScales[i].equalsIgnoreCase(LOGARITHM))) {
- Xmi = 1.0;
- }
- if ((Xma <= 0) && (axesScales[i].equalsIgnoreCase(LOGARITHM))) {
- Xma = 1.0;
- }
- if (Xmi == Xma) {
- Xmi = Xma - 1;
- }
- if (Xmi > Xma) {
- throw new IllegalArgumentException("Error while bounding dimension " + (i + 1) + " : min " + Xmi + " must be < to max " + Xma);
- }
- roundXmin[i] = Xmi;
- roundXmax[i] = Xma;
- resetCoords();
- }
-
- /*
- * private void setBounds(double[] Xmi, double[] Xma) { for (int i = 0; i <
- * Xmi.length; i++) { setBounds(i, Xmi[i], Xma[i]); } }
- */
-
- public void setFixedBounds(int i, double Xmi, double Xma) {
- setPrecisionUnit(i, Xmi, Xma);
- setBounds(i, Xmi, Xma);
- }
-
- public void setFixedBounds(double[] Xmi, double[] Xma) {
- for (int i = 0; i < Xmi.length; i++) {
- setFixedBounds(i, Xmi[i], Xma[i]);
- }
- }
-
- public void roundBounds(int i) {
- setPrecisionUnit(i, trueXmin[i], trueXmax[i]);
- if (axesScales[i].equalsIgnoreCase(LOGARITHM)) {
- setBounds(i, FastMath.pow(10, FastMath.floor(FastMath.log(trueXmin[i]) / FastMath.log(10))), FastMath.pow(10, FastMath.ceil(FastMath.log(trueXmax[i]) / FastMath.log(10))));
- } else if (axesScales[i].equalsIgnoreCase(LINEAR) || axesScales[i].equalsIgnoreCase(STRINGS)) {
- if (roundXmin[i] <= roundXmax[i]) {
- setBounds(i, precisionUnit[i] * (FastMath.floor(trueXmin[i] / precisionUnit[i])), precisionUnit[i] * (FastMath.ceil(trueXmax[i] / precisionUnit[i])));
- } else {
- setBounds(i, precisionUnit[i] * (FastMath.ceil(trueXmax[i] / precisionUnit[i])), precisionUnit[i] * (FastMath.floor(trueXmin[i] / precisionUnit[i])));
- }
- }
-
- /*
- * System.out.println("precisionUnit[" + i + "]=" + precisionUnit[i]);
- * System.out.println("trueXmin["+i+"]="+trueXmin[i]);
- * System.out.println("trueXmax["+i+"]="+trueXmax[i]);
- * System.out.println("roundXmin["+i+"]="+roundXmin[i]);
- * System.out.println("roundXmax["+i+"]="+roundXmax[i]);
- *
- * System.out.println("Xmi=" + trueXmin[i] + " Xma=" + trueXmax[i]);
- * System.out.println( " -> precisionUnit[i] * (Math.floor(Xmi /
- * precisionUnit[i]))=" + precisionUnit[i] * (Math.floor(trueXmin[i] /
- * precisionUnit[i]))); System.out.println( " -> precisionUnit[i] *
- * (Math.ceil(Xma / precisionUnit[i]))=" + precisionUnit[i] *
- * (ceil(trueXmax[i] / precisionUnit[i])));
- */
-
- }
-
- public void setRoundBounds(int i, double Xmi, double Xma) {
- trueXmin[i] = Xmi;
- trueXmax[i] = Xma;
- roundBounds(i);
- }
-
- public void setRoundBounds(double[] Xmi, double[] Xma) {
- for (int i = 0; i < Xmi.length; i++) {
- trueXmin[i] = Xmi[i];
- trueXmax[i] = Xma[i];
- roundBounds(i);
- }
- }
-
- public boolean includeInBounds(int dim, double XY) {
- boolean changed = false;
- for (int i = 0; i < roundXmin.length; i++) {
- if (i == dim) {
- if (XY < trueXmin[i]) {
- trueXmin[i] = XY;
- changed = true;
- }
- }
- }
- for (int i = 0; i < roundXmax.length; i++) {
- if (i == dim) {
- if (XY > trueXmax[i]) {
- trueXmax[i] = XY;
- changed = true;
- }
- }
- }
- if (changed) {
- roundBounds(dim);
- }
- return changed;
- }
-
- public boolean includeInBounds(double[] XY) {
- boolean changed = false;
- for (int i = 0; i < roundXmin.length; i++) {
- if (XY[i] < trueXmin[i]) {
- trueXmin[i] = XY[i];
- changed = true;
- }
- }
- for (int i = 0; i < roundXmax.length; i++) {
- if (XY[i] > trueXmax[i]) {
- trueXmax[i] = XY[i];
- changed = true;
- }
- }
- if (changed) {
- setRoundBounds(trueXmin, trueXmax);
- }
- return changed;
- }
-
- // ///////////////////////////////////////////
- // ////// other public methods ///////////////
- // ///////////////////////////////////////////
-
- public boolean authorizedLogScale(int i) {
- // System.out.println("Xmin[" + i + "] = " + roundXmin[i]);
- return roundXmin[i] > 0;
- }
-
- public String toString() {
- StringBuffer s = new StringBuffer();
- for (int i = 0; i < baseCoords.length; i++) {
- s.append("[");
- for (int j = 0; j < baseCoords[i].length; j++) {
- s.append(baseCoords[i][j] + ",");
- }
- s.deleteCharAt(s.length() - 1);
- s.append("]");
- }
- return s.toString();
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseDependant.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseDependant.java
deleted file mode 100644
index ad751c0..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseDependant.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-
-public interface BaseDependant {
- void resetBase();
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseLabel.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseLabel.java
deleted file mode 100644
index 581ad1e..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseLabel.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.canvas.Plot3DCanvas;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-
-public class BaseLabel extends Label /* implements BaseDependant */ {
-
- public BaseLabel(String l, Color c, double... rC) {
- super(l, c, rC);
- }
-
- /*
- * public void resetBase() { System.out.println("BaseLabel.resetBase"); }
- */
-
- public static void main(String[] args) {
- Plot3DCanvas p3d = new Plot3DCanvas(new double[]{0, 0, 0}, new double[]{10, 10, 10}, new String[]{"lin", "lin", "lin"}, new String[]{"x",
- "y", "z"});
- new FrameView(p3d);
- // p3d.addPlot(DoubleArray.random(10, 3), "plot", "SCATTER");
- p3d.addPlotable(new BaseLabel("label", Color.RED, -0.1, 0.5, 0.5));
- }
-
- public void plot(AbstractDrawer draw) {
- draw.setColor(color);
- draw.setFont(font);
- draw.setTextAngle(angle);
- draw.setTextOffset(cornerE, cornerN);
- draw.drawTextBase(label, coord);
- }
-
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseLine.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseLine.java
deleted file mode 100644
index e8656af..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BaseLine.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Created on 1 juin 2005 by richet
- */
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-
-public class BaseLine extends Line {
-
- public BaseLine(Color col, double[] c1, double[] c2) {
- super(col, c1, c2);
- }
-
- public void plot(AbstractDrawer draw) {
- if (!visible) {
- return;
- }
-
- draw.setColor(color);
- draw.drawLineBase(extrem[0], extrem[1]);
- }
-
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BasePlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BasePlot.java
deleted file mode 100644
index 4207b0f..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BasePlot.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-
-public class BasePlot implements /*Plotable,*/BaseDependant {
-
- public static Color DEFAULT_COLOR = Color.DARK_GRAY;
-
- protected Base base;
-
- protected Axis[] axis;
-
- protected boolean visible = true;
-
- protected Color color;
-
- public BasePlot(Base b, String... as) {
- this(b, DEFAULT_COLOR, as);
- }
-
- public BasePlot(Base b, Color c, Axis... a) {
- base = b;
- axis = a;
- color = c;
- }
-
- public BasePlot(Base b, Color c, String... as) {
- base = b;
- if (as.length != base.dimension) {
- throw new IllegalArgumentException("String array of axes names must have " + base.dimension + " elements.");
- }
- color = c;
- axis = new Axis[base.dimension];
- for (int i = 0; i < base.dimension; i++) {
- axis[i] = new Axis(base, as[i], color, i);
- }
- // resetBase();
- }
-
- public void setVisible(boolean v) {
- visible = v;
- }
-
- public void setVisible(int i, boolean v) {
- axis[i].setVisible(v);
- }
-
- public void setGridVisible(int i, boolean v) {
- axis[i].setGridVisible(v);
- }
-
- public boolean getVisible() {
- return visible;
- }
-
- public void setColor(Color c) {
- color = c;
- for (int i = 0; i < axis.length; i++) {
- axis[i].setColor(c);
- }
- }
-
- public Color getColor() {
- return color;
- }
-
- public void setLegend(String[] as) {
- if (as.length != base.dimension) {
- throw new IllegalArgumentException("String array of axes names must have " + base.dimension + " elements.");
- }
- for (int i = 0; i < axis.length; i++) {
- axis[i].setLegend(as[i]);
- }
- // resetBase();
- }
-
- public void setLegend(int i, String as) {
- axis[i].setLegend(as);
- // resetBase();
- }
-
- public String[] getLegend() {
- String[] array = new String[axis.length];
- for (int i = 0; i < array.length; i++) {
- array[i] = axis[i].getLegend();
- }
- return array;
- }
-
- public String getLegend(int i) {
- return axis[i].getLegend();
- }
-
- public void setBase(Base b) {
- base = b;
- for (int i = 0; i < axis.length; i++) {
- axis[i].base = base;
- }
- resetBase();
- }
-
- public void plot(AbstractDrawer draw) {
- if (!visible) {
- return;
- }
-
- for (int i = 0; i < axis.length; i++) {
- axis[i].plot(draw);
- }
- }
-
- public Axis getAxis(int i) {
- return axis[i];
- }
-
- public Axis[] getAxis() {
- return axis;
- }
-
- public void resetBase() {
- // System.out.println("BasePlot.resetBase");
- for (int i = 0; i < axis.length; i++) {
- axis[i].resetBase();
- //base.setAxesScales(i, Base.LINEAR);
- }
- }
-
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BoxPlot2D.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BoxPlot2D.java
deleted file mode 100644
index cc1ae20..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BoxPlot2D.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-
-public class BoxPlot2D extends Plot {
-
- double[] Xmin;
- double[] Xmax;
- double[] Ymin;
- double[] Ymax;
- double[][] widths;
- double[][] XY;
-
- public BoxPlot2D(double[][] _XY, double[][] w, Color c, String n) {
- super(n, c);
- XY = _XY;
- widths = w;
-
- // double[] datasMin = Array.min(XY);
- // double[] datasMax = Array.max(XY);
- // double[] widthsMax = Array.max(widths);
- // double[] min = { datasMin[0] - widthsMax[0] / 2, datasMin[1] -
- // widthsMax[1] / 2 };
- // double[] max = { datasMax[0] + widthsMax[0] / 2, datasMax[1] +
- // widthsMax[1] / 2 };
- // base.includeInBounds(min);
- // base.includeInBounds(max);
-
- Xmin = new double[XY.length];
- Xmax = new double[XY.length];
- Ymin = new double[XY.length];
- Ymax = new double[XY.length];
- for (int i = 0; i < XY.length; i++) {
- Xmin[i] = XY[i][0] - widths[i][0] / 2;
- Xmax[i] = XY[i][0] + widths[i][0] / 2;
- Ymin[i] = XY[i][1] - widths[i][1] / 2;
- Ymax[i] = XY[i][1] + widths[i][1] / 2;
- }
-
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length; i++) {
- draw.drawLine(new double[]{Xmin[i], Ymin[i]}, new double[]{Xmax[i], Ymin[i]});
- draw.drawLine(new double[]{Xmax[i], Ymin[i]}, new double[]{Xmax[i], Ymax[i]});
- draw.drawLine(new double[]{Xmax[i], Ymax[i]}, new double[]{Xmin[i], Ymax[i]});
- draw.drawLine(new double[]{Xmin[i], Ymax[i]}, new double[]{Xmin[i], Ymin[i]});
- draw.setDotType(AbstractDrawer.ROUND_DOT);
- draw.setDotRadius(AbstractDrawer.DEFAULT_DOT_RADIUS);
- draw.drawDot(XY[i]);
- }
- }
-
- @Override
- public void setData(double[][] d) {
- datapanel = null;
- XY = d;
- }
-
- @Override
- public double[][] getData() {
- return XY;
- }
-
- @Override
- public double[][] getBounds() {
- return new double[][]{{Array.min(Xmin), Array.min(Ymin)}, {Array.max(Xmax), Array.max(Ymax)}};
- }
-
- public void setDataWidth(double[][] w) {
- widths = w;
- }
-
- public double[][] getDataWidth() {
- return widths;
- }
-
- public void setData(double[][] d, double[][] w) {
- setData(d);
- widths = w;
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- for (int i = 0; i < XY.length; i++) {
- int[] screenCoord = draw.project(XY[i]);
-
- if ((screenCoord[0] + note_precision > screenCoordTest[0]) && (screenCoord[0] - note_precision < screenCoordTest[0])
- && (screenCoord[1] + note_precision > screenCoordTest[1]) && (screenCoord[1] - note_precision < screenCoordTest[1])) {
- return XY[i];
- }
- }
- return null;
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BoxPlot3D.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BoxPlot3D.java
deleted file mode 100644
index 9f7b337..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/BoxPlot3D.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-public class BoxPlot3D extends Plot {
-
- double[] Xmin;
- double[] Xmax;
- double[] Ymin;
- double[] Ymax;
- double[] Zmin;
- double[] Zmax;
- double[][] widths;
- double[][] XY;
-
- public BoxPlot3D(double[][] _XY, double[][] w, Color c, String n) {
- super(n, c);
- XY = _XY;
- widths = w;
-
- // double[] datasMin = Array.min(XY);
- // double[] datasMax = Array.max(XY);
- // double[] widthsMax = Array.max(widths);
- // double[] min = { datasMin[0] - widthsMax[0] / 2, datasMin[1] -
- // widthsMax[1] / 2, datasMin[2] - widthsMax[2] / 2 };
- // double[] max = { datasMax[0] + widthsMax[0] / 2, datasMax[1] +
- // widthsMax[1] / 2, datasMax[2] + widthsMax[2] / 2 };
- // base.includeInBounds(min);
- // base.includeInBounds(max);
-
- Xmin = new double[XY.length];
- Xmax = new double[XY.length];
- Ymin = new double[XY.length];
- Ymax = new double[XY.length];
- Zmin = new double[XY.length];
- Zmax = new double[XY.length];
- for (int i = 0; i < XY.length; i++) {
- Xmin[i] = XY[i][0] - widths[i][0] / 2;
- Xmax[i] = XY[i][0] + widths[i][0] / 2;
- Ymin[i] = XY[i][1] - widths[i][1] / 2;
- Ymax[i] = XY[i][1] + widths[i][1] / 2;
- Zmin[i] = XY[i][2] - widths[i][2] / 2;
- Zmax[i] = XY[i][2] + widths[i][2] / 2;
- }
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length; i++) {
- draw.drawLine(new double[]{Xmin[i], Ymin[i], Zmin[i]}, new double[]{Xmax[i], Ymin[i], Zmin[i]});
- draw.drawLine(new double[]{Xmax[i], Ymin[i], Zmin[i]}, new double[]{Xmax[i], Ymax[i], Zmin[i]});
- draw.drawLine(new double[]{Xmax[i], Ymax[i], Zmin[i]}, new double[]{Xmin[i], Ymax[i], Zmin[i]});
- draw.drawLine(new double[]{Xmin[i], Ymax[i], Zmin[i]}, new double[]{Xmin[i], Ymin[i], Zmin[i]});
-
- draw.drawLine(new double[]{Xmin[i], Ymin[i], Zmax[i]}, new double[]{Xmax[i], Ymin[i], Zmax[i]});
- draw.drawLine(new double[]{Xmax[i], Ymin[i], Zmax[i]}, new double[]{Xmax[i], Ymax[i], Zmax[i]});
- draw.drawLine(new double[]{Xmax[i], Ymax[i], Zmax[i]}, new double[]{Xmin[i], Ymax[i], Zmax[i]});
- draw.drawLine(new double[]{Xmin[i], Ymax[i], Zmax[i]}, new double[]{Xmin[i], Ymin[i], Zmax[i]});
-
- draw.drawLine(new double[]{Xmin[i], Ymin[i], Zmin[i]}, new double[]{Xmin[i], Ymin[i], Zmax[i]});
- draw.drawLine(new double[]{Xmax[i], Ymin[i], Zmin[i]}, new double[]{Xmax[i], Ymin[i], Zmax[i]});
- draw.drawLine(new double[]{Xmin[i], Ymax[i], Zmin[i]}, new double[]{Xmin[i], Ymax[i], Zmax[i]});
- draw.drawLine(new double[]{Xmax[i], Ymax[i], Zmin[i]}, new double[]{Xmax[i], Ymax[i], Zmax[i]});
-
- draw.drawDot(XY[i]);
- }
- }
-
- @Override
- public void setData(double[][] d) {
- datapanel = null;
- XY = d;
- }
-
- @Override
- public double[][] getData() {
- return XY;
- }
-
- @Override
- public double[][] getBounds() {
- return new double[][]{{Array.min(Xmin), Array.min(Ymin), Array.min(Zmin)}, {Array.max(Xmax), Array.max(Ymax), Array.max(Zmax)}};
- }
-
- public void setDataWidth(double[][] w) {
- widths = w;
- }
-
- public double[][] getDataWidth() {
- return widths;
- }
-
- public void setData(double[][] d, double[][] w) {
- setData(d);
- widths = w;
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- for (int i = 0; i < XY.length; i++) {
- int[] screenCoord = draw.project(XY[i]);
-
- if ((screenCoord[0] + note_precision > screenCoordTest[0]) && (screenCoord[0] - note_precision < screenCoordTest[0])
- && (screenCoord[1] + note_precision > screenCoordTest[1]) && (screenCoord[1] - note_precision < screenCoordTest[1])) {
- return XY[i];
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- Plot3DPanel plotpanel = new Plot3DPanel();
- for (int i = 0; i < 1; i++) {
- double[][] receiverXYZ = new double[100][6];
- for (int j = 0; j < receiverXYZ.length; j++) {
- receiverXYZ[j][0] = /*1 + */ Math.random();
- receiverXYZ[j][1] = /*100 * */ Math.random();
- receiverXYZ[j][2] = /*100 * */ Math.random();
- receiverXYZ[j][3] = /*1 + */ Math.random() / 10;
- receiverXYZ[j][4] = /*100 * */ Math.random() / 10;
- receiverXYZ[j][5] = /*100 * */ Math.random() / 10;
- }
- int receiverPlotDataIndex = plotpanel.addBoxPlot("Receivers", Color.orange, receiverXYZ);
- }
-
- plotpanel.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(plotpanel).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/CloudPlot2D.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/CloudPlot2D.java
deleted file mode 100644
index a792f20..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/CloudPlot2D.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Created on 13 juil. 07 by richet
- */
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-public class CloudPlot2D extends Plot {
-
- double[][] NW;
- double[][] NE;
- double[][] SW;
- double[][] SE;
- double[] width_constant = {-1, -1};
- double[][] XY;
- float[] f;
- boolean fill_shape = true;
-
- public CloudPlot2D(String n, Color c, double[][] _XYcard, double wX, double wY) {
- super(n, c);
- splitXYf(_XYcard);
- width_constant = new double[]{wX, wY};
-
- build();
- }
-
- private void splitXYf(double[][] xycard) {
- XY = new double[xycard.length][2];
- f = new float[xycard.length];
- float normf = 0;
- for (int i = 0; i < xycard.length; i++) {
- XY[i][0] = xycard[i][0];
- XY[i][1] = xycard[i][1];
- f[i] = (float) xycard[i][2];
- normf += f[i];//Math.max(normf, f[i]);
- }
-
- for (int i = 0; i < f.length; i++) {
- f[i] = f[i] / normf;
- }
-
- }
-
- private void build() {
- if (width_constant[0] > 0) {
- NW = new double[XY.length][];
- NE = new double[XY.length][];
- SW = new double[XY.length][];
- SE = new double[XY.length][];
- for (int i = 0; i < XY.length; i++) {
- NW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] + width_constant[1] / 2};
- NE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] + width_constant[1] / 2};
- SW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] - width_constant[1] / 2};
- SE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] - width_constant[1] / 2};
- }
- }
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- draw.canvas.includeInBounds(SW[0]);
- draw.canvas.includeInBounds(NE[XY.length - 1]);
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length; i++) {
- if (f[i] > 0) {
- draw.fillPolygon(f[i], NW[i], NE[i], SE[i], SW[i]);
- }
- }
- }
-
- @Override
- public void setData(double[][] d) {
- datapanel = null;
- splitXYf(d);
- }
-
- @Override
- public double[][] getData() {
- return XY;
- }
-
- @Override
- public double[][] getBounds() {
- double[][] b = new double[][]{Array.min(XY), Array.max(XY)};
- for (int i = 0; i < b[0].length; i++) {
- b[0][i] = b[0][i] - width_constant[i] / 2;
- b[1][i] = b[1][i] + width_constant[i] / 2;
- }
- return b;
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- for (int i = 0; i < XY.length; i++) {
- int[] screenCoord = draw.project(XY[i]);
-
- if ((screenCoord[0] + note_precision > screenCoordTest[0]) && (screenCoord[0] - note_precision < screenCoordTest[0])
- && (screenCoord[1] + note_precision > screenCoordTest[1]) && (screenCoord[1] - note_precision < screenCoordTest[1])) {
- return XY[i];
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- Plot2DPanel p = new Plot2DPanel();
-
- double[][] cloud = new double[100][2];
- for (int i = 0; i < cloud.length; i++) {
- cloud[i][0] = Math.random() + Math.random();
- cloud[i][1] = Math.random() + Math.random();
- }
- p.addCloudPlot("cloud", Color.RED, cloud, 5, 5);
-
- double[][] cloud2 = new double[100][2];
- for (int i = 0; i < cloud2.length; i++) {
- cloud2[i][0] = 2 + Math.random() + Math.random();
- cloud2[i][1] = 2 + Math.random() + Math.random();
- }
- p.addCloudPlot("cloud2", Color.RED, cloud2, 5, 5);
-
- p.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/CloudPlot3D.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/CloudPlot3D.java
deleted file mode 100644
index b0e474f..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/CloudPlot3D.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Created on 13 juil. 07 by richet
- */
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-public class CloudPlot3D extends Plot {
-
- double[][] topNW;
- double[][] topNE;
- double[][] topSW;
- double[][] topSE;
- double[][] botNW;
- double[][] botNE;
- double[][] botSW;
- double[][] botSE;
- double[] width_constant = {-1, -1, -1};
- double[][] XY;
- float[] f;
- boolean fill_shape = true;
-
- public CloudPlot3D(String n, Color c, double[][] _XYcard, double wX, double wY, double wZ) {
- super(n, c);
- splitXYf(_XYcard);
- width_constant = new double[]{wX, wY, wZ};
-
- build();
- }
-
- private void splitXYf(double[][] xycard) {
- XY = new double[xycard.length][3];
- f = new float[xycard.length];
- float normf = 0;
- for (int i = 0; i < xycard.length; i++) {
- XY[i][0] = xycard[i][0];
- XY[i][1] = xycard[i][1];
- XY[i][2] = xycard[i][2];
- f[i] = (float) xycard[i][3];
- normf += f[i];//Math.max(normf, f[i]);
- }
-
- for (int i = 0; i < f.length; i++) {
- f[i] = f[i] / normf;
- }
-
- }
-
- private void build() {
- if (width_constant[0] > 0) {
- topNW = new double[XY.length][];
- topNE = new double[XY.length][];
- topSW = new double[XY.length][];
- topSE = new double[XY.length][];
- botNW = new double[XY.length][];
- botNE = new double[XY.length][];
- botSW = new double[XY.length][];
- botSE = new double[XY.length][];
- for (int i = 0; i < XY.length; i++) {
- topNW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] + width_constant[1] / 2, XY[i][2] + width_constant[2] / 2};
- topNE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] + width_constant[1] / 2, XY[i][2] + width_constant[2] / 2};
- topSW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] - width_constant[1] / 2, XY[i][2] + width_constant[2] / 2};
- topSE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] - width_constant[1] / 2, XY[i][2] + width_constant[2] / 2};
- botNW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] + width_constant[1] / 2, XY[i][2] - width_constant[2] / 2};
- botNE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] + width_constant[1] / 2, XY[i][2] - width_constant[2] / 2};
- botSW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] - width_constant[1] / 2, XY[i][2] - width_constant[2] / 2};
- botSE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] - width_constant[1] / 2, XY[i][2] - width_constant[2] / 2};
- }
- }
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- draw.canvas.includeInBounds(botSW[0]);
- draw.canvas.includeInBounds(topNE[XY.length - 1]);
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length; i++) {
- if (f[i] > 0) {
- draw.fillPolygon(f[i], topNW[i], topNE[i], topSE[i], topSW[i]);
- draw.fillPolygon(f[i], botNW[i], botNE[i], botSE[i], botSW[i]);
-
- draw.fillPolygon(f[i], botNW[i], botNE[i], topNE[i], topNW[i]);
- draw.fillPolygon(f[i], botSW[i], botSE[i], topSE[i], topSW[i]);
-
- draw.fillPolygon(f[i], botNW[i], botSW[i], topSW[i], topNW[i]);
- draw.fillPolygon(f[i], botNE[i], botSE[i], topSE[i], topNE[i]);
- }
- }
- }
-
- @Override
- public void setData(double[][] d) {
- datapanel = null;
- splitXYf(d);
- }
-
- @Override
- public double[][] getData() {
- return XY;
- }
-
- @Override
- public double[][] getBounds() {
- double[][] b = new double[][]{Array.min(XY), Array.max(XY)};
- for (int i = 0; i < b[0].length; i++) {
- b[0][i] = b[0][i] - width_constant[i] / 2;
- b[1][i] = b[1][i] + width_constant[i] / 2;
- }
- return b;
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- for (int i = 0; i < XY.length; i++) {
- int[] screenCoord = draw.project(XY[i]);
-
- if ((screenCoord[0] + note_precision > screenCoordTest[0]) && (screenCoord[0] - note_precision < screenCoordTest[0])
- && (screenCoord[1] + note_precision > screenCoordTest[1]) && (screenCoord[1] - note_precision < screenCoordTest[1])) {
- return XY[i];
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- Plot3DPanel p = new Plot3DPanel();
-
- //triangular random cloud (as sum of two uniform random numbers)
- double[][] cloud = new double[100][3];
- for (int i = 0; i < cloud.length; i++) {
- cloud[i][0] = Math.random() + Math.random();
- cloud[i][1] = Math.random() + Math.random();
- cloud[i][2] = Math.random() + Math.random();
- }
- p.addCloudPlot("cloud", Color.RED, cloud, 3, 3, 3);
-
- double[][] cloud2 = new double[100][3];
- for (int i = 0; i < cloud.length; i++) {
- cloud2[i][0] = 2 + Math.random() + Math.random();
- cloud2[i][1] = 2 + Math.random() + Math.random();
- cloud2[i][2] = 2 + Math.random() + Math.random();
- }
- p.addCloudPlot("cloud2", Color.RED, cloud2, 3, 3, 3);
-
- p.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/DensityLayerPlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/DensityLayerPlot.java
deleted file mode 100644
index 5638cbc..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/DensityLayerPlot.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-/**
- * @author Yann RICHET
- */
-
-public class DensityLayerPlot extends LayerPlot {
-
- public static int WIDTH = 2;
-
- int axis;
-
- double[] constant_Q;
-
- double[][] Q;
-
- public DensityLayerPlot(Plot p, int a, double[] quantiles) {
- this(p, a, new double[0][0]);
- constant_Q = quantiles;
- }
-
- /**
- * Build a quantile plot based on given plot. The quantile is drawn as a linear gradient from the base plot dots.
- *
- * @param p base plot
- * @param a axis number of quantile : 0=X quantile, 1=Y quantile, 2=Z quantile
- * @param quantiles array of standard deviation values
- */
- public DensityLayerPlot(Plot p, int a, double[][] quantiles) {
- super("Density of " + p.name, p);
- if (quantiles != null && quantiles.length > 0) {
- Array.checkRowDimension(quantiles, p.getData().length);
- }
- Q = quantiles;
- axis = a;
- }
-
- public int getAxe() {
- return axis;
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!plot.visible) {
- return;
- }
-
- draw.setColor(c);
-
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- draw.setLineWidth(WIDTH);
- if (constant_Q == null) {
- for (int i = 0; i < plot.getData().length; i++) {
-
- double norm = Double.MAX_VALUE;
- for (int j = 0; j < Q[i].length - 1; j++) {
- norm = Math.min(1 / (Q[i][j + 1] - Q[i][j]), norm);
- }
-
- double[] d0 = Array.getRowCopy(plot.getData(), i);
- double[] d1 = Array.getRowCopy(plot.getData(), i);
- double[] d2 = Array.getRowCopy(plot.getData(), i);
-
- for (int j = 0; j < Q[i].length - 2; j++) {
- d1[axis] = d0[axis] + ((Q[i][j] + Q[i][j + 1]) / 2);
- d2[axis] = d0[axis] + ((Q[i][j + 1] + Q[i][j + 2]) / 2);
- Color c1 = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (norm / (Q[i][j + 1] - Q[i][j]))));
- Color c2 = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (norm / (Q[i][j + 2] - Q[i][j + 1]))));
- draw.setGradient(d1, c1, d2, c2);
- draw.drawLine(d1, d2);
- }
- }
- } else {
-
- double norm = Double.MAX_VALUE;
- for (int j = 0; j < constant_Q.length - 1; j++) {
- norm = Math.min(1 / (constant_Q[j + 1] - constant_Q[j]), norm);
- }
-
- for (int i = 0; i < plot.getData().length; i++) {
- double[] d0 = Array.getRowCopy(plot.getData(), i);
- double[] d1 = Array.getRowCopy(plot.getData(), i);
- double[] d2 = Array.getRowCopy(plot.getData(), i);
-
- for (int j = 0; j < constant_Q.length - 2; j++) {
- d1[axis] = d0[axis] + (constant_Q[j] + constant_Q[j + 1]) / 2;
- d2[axis] = d0[axis] + (constant_Q[j + 1] + constant_Q[j + 2]) / 2;
- Color c1 = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (norm / (constant_Q[j + 1] - constant_Q[j]))));
- Color c2 = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (norm / (constant_Q[j + 2] - constant_Q[j + 1]))));
- draw.setGradient(d1, c1, d2, c2);
- draw.drawLine(d1, d2);
- }
- }
- }
- draw.resetGradient();
- draw.setLineWidth(AbstractDrawer.DEFAULT_LINE_WIDTH);
-
- }
-
- @Override
- public void setData(double[][] d) {
- //Q = d[0];
- }
-
- @Override
- public double[][] getData() {
- return null;//new double[][] { sigma };
- }
-
- public static void main(String[] args) {
- Plot2DPanel p2 = new Plot2DPanel();
- for (int i = 0; i < 2; i++) {
- double[][] XYZ = new double[10][2];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = /*1 + */Math.random();
- XYZ[j][1] = /*100 * */10 * Math.random();
- }
-
- p2.addScatterPlot("toto" + i, XYZ);
- }
- p2.getPlot(0).addQuantiles(1, new double[]{/*-3,-2,*/-4, -2, -0.5, 0, 0.5, 2, 4 /*,2,3*/});
- p2.getPlot(1).addQuantiles(1, new double[]{-3, -2, -1, 0, 1, 2, 3});
- //p2.getPlot(1).addLayer(new DensityLayerPlot(p2.getPlot(1), 1, new double[] { -.1, 0, .1 }));
-
- new FrameView(p2).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Editable.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Editable.java
deleted file mode 100644
index 05ee0bf..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Editable.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-public interface Editable {
- double[] isSelected(int[] screenCoord, AbstractDrawer draw);
-
- void edit(Object editParent);
-
- void editnote(AbstractDrawer draw);
-
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/GaussianDensityLayerPlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/GaussianDensityLayerPlot.java
deleted file mode 100644
index 10faf62..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/GaussianDensityLayerPlot.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-/**
- * @author Yann RICHET
- */
-
-public class GaussianDensityLayerPlot extends LayerPlot {
-
- public static int WIDHT = 2;
-
- int axis;
-
- Color gradC_0sigma, gradC_1sigma, gradC_2sigma, gradC_3sigma;
-
- double constant_sigma = 0;
-
- double[] sigma;
-
- private float[][] gausspdf_sigma;
-
- public GaussianDensityLayerPlot(Plot p, int ax, double sigma) {
- this(p, ax, null);
- constant_sigma = sigma;
-
- gausspdf_sigma = new float[1][4];
- for (int i = 0; i < gausspdf_sigma.length; i++) {
- for (int j = 0; j < 4; j++) {
- gausspdf_sigma[i][j] = (float) (/*1.0 / Math.sqrt(2 * Math.PI * constant_sigma * constant_sigma) */Math.exp(-(j * j)
- / (2.0 * constant_sigma * constant_sigma)));
- }
- }
-
- }
-
- /*public QuantilePlot(Plot p, int a, double q) {
- this(p, a, q, DEFAULT_RATE,true);
- }*/
-
- /**
- * Build a gauss quantile plot based on given plot. The quantile is drawn as a gaussian gradient from the base plot dots.
- *
- * @param p base plot
- * @param ax axis number of quantile : 0=X quantile, 1=Y quantile, 2=Z quantile
- * @param sigma array of standard deviation values
- */
- public GaussianDensityLayerPlot(Plot p, int ax, double[] sigma) {
- super("Gauss quantile of " + p.name, p);
- if (sigma != null) {
- Array.checkLength(sigma, p.getData().length);
- }
- this.sigma = sigma;
- axis = ax;
-
- if (sigma != null) {
- gausspdf_sigma = new float[sigma.length][4];
- for (int i = 0; i < gausspdf_sigma.length; i++) {
- for (int j = 0; j < 4; j++) {
- gausspdf_sigma[i][j] = (float) (/*1.0 / Math.sqrt(2 * Math.PI * sigma[i] * sigma[i]) */Math.exp(-(j * j) / (2.0 * sigma[i] * sigma[i])));
- }
- }
- }
-
- }
-
- public double getQuantilesValue(int numCoord) {
- return sigma[numCoord];
- }
-
- public int getAxe() {
- return axis;
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!plot.visible) {
- return;
- }
-
- draw.setColor(c);
-
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- draw.setLineWidth(WIDHT);
- if (constant_sigma == 0) {
- for (int i = 0; i < plot.getData().length; i++) {
- gradC_0sigma = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (gausspdf_sigma[i][0])));
- gradC_1sigma = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (gausspdf_sigma[i][1])));
- gradC_2sigma = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (gausspdf_sigma[i][2])));
- gradC_3sigma = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (gausspdf_sigma[i][3])));
-
- double[] d = Array.getRowCopy(plot.getData(), i);
- double[] d2 = Array.getRowCopy(plot.getData(), i);
- d2[axis] += sigma[i];
- draw.setGradient(d, gradC_0sigma, d2, gradC_1sigma);
- draw.drawLine(d, d2);
-
- d[axis] += sigma[i];
- d2[axis] += sigma[i];
- draw.setGradient(d, gradC_1sigma, d2, gradC_2sigma);
- draw.drawLine(d, d2);
-
- d[axis] += sigma[i];
- d2[axis] += sigma[i];
- draw.setGradient(d, gradC_2sigma, d2, gradC_3sigma);
- draw.drawLine(d, d2);
-
- d = Array.getRowCopy(plot.getData(), i);
- d2 = Array.getRowCopy(plot.getData(), i);
- d2[axis] -= sigma[i];
- draw.setGradient(d2, gradC_1sigma, d, gradC_0sigma);
- draw.drawLine(d2, d);
-
- d[axis] -= sigma[i];
- d2[axis] -= sigma[i];
- draw.setGradient(d2, gradC_2sigma, d, gradC_1sigma);
- draw.drawLine(d2, d);
-
- d[axis] -= sigma[i];
- d2[axis] -= sigma[i];
- draw.setGradient(d2, gradC_3sigma, d, gradC_2sigma);
- draw.drawLine(d2, d);
- }
- } else {
- gradC_0sigma = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (gausspdf_sigma[0][0])));
- gradC_1sigma = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (gausspdf_sigma[0][1])));
- gradC_2sigma = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (gausspdf_sigma[0][2])));
- gradC_3sigma = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255.0 * (gausspdf_sigma[0][3])));
-
- for (int i = 0; i < plot.getData().length; i++) {
-
- double[] d = Array.getRowCopy(plot.getData(), i);
- double[] d2 = Array.getRowCopy(plot.getData(), i);
- d2[axis] += constant_sigma;
- draw.setGradient(d, gradC_0sigma, d2, gradC_1sigma);
- draw.drawLine(d, d2);
-
- d[axis] += constant_sigma;
- d2[axis] += constant_sigma;
- draw.setGradient(d, gradC_1sigma, d2, gradC_2sigma);
- draw.drawLine(d, d2);
-
- d[axis] += constant_sigma;
- d2[axis] += constant_sigma;
- draw.setGradient(d, gradC_2sigma, d2, gradC_3sigma);
- draw.drawLine(d, d2);
-
- d = Array.getRowCopy(plot.getData(), i);
- d2 = Array.getRowCopy(plot.getData(), i);
- d2[axis] -= constant_sigma;
- draw.setGradient(d2, gradC_1sigma, d, gradC_0sigma);
- draw.drawLine(d2, d);
-
- d[axis] -= constant_sigma;
- d2[axis] -= constant_sigma;
- draw.setGradient(d2, gradC_2sigma, d, gradC_1sigma);
- draw.drawLine(d2, d);
-
- d[axis] -= constant_sigma;
- d2[axis] -= constant_sigma;
- draw.setGradient(d2, gradC_3sigma, d, gradC_2sigma);
- draw.drawLine(d2, d);
- }
- }
- draw.resetGradient();
- draw.setLineWidth(AbstractDrawer.DEFAULT_LINE_WIDTH);
-
- }
-
- @Override
- public void setData(double[][] d) {
- sigma = d[0];
- }
-
- @Override
- public double[][] getData() {
- return new double[][]{sigma};
- }
-
- public static void main(String[] args) {
- double[] sXYZ = null;
-
- Plot2DPanel p2 = new Plot2DPanel();
- for (int i = 0; i < 2; i++) {
- double[][] XYZ = new double[10][2];
- sXYZ = new double[10];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = /*1 + */Math.random();
- XYZ[j][1] = /*100 * */Math.random();
- sXYZ[j] = /*100 * */Math.random();
- }
-
- p2.addScatterPlot("toto" + i, XYZ);
- }
- p2.getPlot(0).addGaussQuantiles(0, sXYZ);
- p2.getPlot(1).addGaussQuantiles(1, 0.1);
-
- new FrameView(p2).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/GridPlot3D.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/GridPlot3D.java
deleted file mode 100644
index 5107506..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/GridPlot3D.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Created on 3 juin 2005 by richet
- */
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-
-public class GridPlot3D extends Plot {
-
- double[] X;
- double[] Y;
- double[][] Z;
- private double[][] XYZ_list;
- public boolean draw_lines = true;
- public boolean fill_shape = true;
-
- public GridPlot3D(String n, Color c, double[] _X, double[] _Y, double[][] _Z) {
- super(n, c);
- X = _X;
- Y = _Y;
- Z = _Z;
- buildXYZ_list();
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- draw.setColor(c);
-
- if (draw_lines) {
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < X.length; i++) {
- for (int j = 0; j < Y.length - 1; j++) {
- draw.drawLine(new double[]{X[i], Y[j], Z[j][i]}, new double[]{X[i], Y[j + 1], Z[j + 1][i]});
- }
- }
-
- for (int j = 0; j < Y.length; j++) {
- for (int i = 0; i < X.length - 1; i++) {
- draw.drawLine(new double[]{X[i], Y[j], Z[j][i]}, new double[]{X[i + 1], Y[j], Z[j][i + 1]});
- }
- }
- } else {
- draw.setDotType(AbstractDrawer.ROUND_DOT);
- draw.setDotRadius(AbstractDrawer.DEFAULT_DOT_RADIUS);
- for (int i = 0; i < X.length; i++) {
- for (int j = 0; j < Y.length; j++) {
- draw.drawDot(X[i], Y[j], Z[j][i]);
- }
- }
- }
-
- if (fill_shape) {
- for (int j = 0; j < Y.length - 1; j++) {
- for (int i = 0; i < X.length - 1; i++) {
- draw.fillPolygon(0.2f, new double[]{X[i], Y[j], Z[j][i]}, new double[]{X[i + 1], Y[j], Z[j][i + 1]}, new double[]{X[i + 1], Y[j + 1],
- Z[j + 1][i + 1]}, new double[]{X[i], Y[j + 1], Z[j + 1][i]});
- }
- }
- }
- }
-
- private void buildXYZ_list() {
- XYZ_list = new double[X.length * Y.length][3];
- for (int i = 0; i < X.length; i++) {
- for (int j = 0; j < Y.length; j++) {
- XYZ_list[i + (j) * X.length][0] = X[i];
- XYZ_list[i + (j) * X.length][1] = Y[j];
- XYZ_list[i + (j) * X.length][2] = Z[j][i];
- }
- }
- }
-
- @Override
- public void setData(double[][] _Z) {
- datapanel = null;
- Z = _Z;
- buildXYZ_list();
- }
-
- @Override
- public double[][] getData() {
- return XYZ_list;
- }
-
- @Override
- public double[][] getBounds() {
- return new double[][]{{Array.min(X), Array.min(Y), Array.min(Array.min(Z))}, {Array.max(X), Array.max(Y), Array.max(Array.min(Z))}};
- }
-
- public void setDataZ(double[][] _Z) {
- setData(_Z);
- }
-
- public double[][] getDataZ() {
- return Z;
- }
-
- public void setDataX(double[] _X) {
- datapanel = null;
- X = _X;
- buildXYZ_list();
- }
-
- public double[] getDataX() {
- return X;
- }
-
- public void setDataY(double[] _Y) {
- datapanel = null;
- Y = _Y;
- buildXYZ_list();
- }
-
- public double[] getDataY() {
- return Y;
- }
-
- public void setDataXYZ(double[] _X, double[] _Y, double[][] _Z) {
- datapanel = null;
- X = _X;
- Y = _Y;
- Z = _Z;
- buildXYZ_list();
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- for (int i = 0; i < X.length; i++) {
- for (int j = 0; j < Y.length; j++) {
- double[] XY = {X[i], Y[j], Z[j][i]};
- int[] screenCoord = draw.project(XY);
-
- if ((screenCoord[0] + note_precision > screenCoordTest[0]) && (screenCoord[0] - note_precision < screenCoordTest[0])
- && (screenCoord[1] + note_precision > screenCoordTest[1]) && (screenCoord[1] - note_precision < screenCoordTest[1])) {
- return XY;
- }
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
-
- int n = 14;
- int m = 16;
- Plot3DPanel p = new Plot3DPanel();
- double[] X = new double[n];
- double[] Y = new double[m];
- double[][] Z = new double[m][n];
-
- for (int i = 0; i < X.length; i++) {
- X[i] = 3 + i / (double) X.length;
- for (int j = 0; j < Y.length; j++) {
- Y[j] = 5 + j / (double) Y.length;
- Z[j][i] = Math.exp(X[i]) + Y[j];
- }
- }
- p.addGridPlot("toto", X, Y, Z);
-
- p.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/HistogramPlot2D.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/HistogramPlot2D.java
deleted file mode 100644
index 4f1e029..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/HistogramPlot2D.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-
-public class HistogramPlot2D extends Plot {
-
- double[][] topLeft;
- double[][] topRight;
- double[][] bottomLeft;
- double[][] bottomRight;
- double[] widths;
- double width_constant = -1;
- double offsetCenter_perWidth;
- double factorWidth;
- boolean autowidth;
- boolean fill_shape = true;
- double[][] XY;
-
- public HistogramPlot2D(String n, Color c, double[][] _XY, double w) {
- this(n, c, _XY, w, 0.5, 1);
- }
-
- public HistogramPlot2D(String n, Color c, double[][] _XY, double[] w) {
- this(n, c, _XY, w, 0.5, 1);
- }
-
- // TODO Histogram group plots
- public HistogramPlot2D(String n, Color c, double[][] _XY, double w, double _offsetCenter_perWidth, double _factorWidth) {
- super(n, c);
- XY = _XY;
- width_constant = w;
-
- autowidth = false;
- offsetCenter_perWidth = _offsetCenter_perWidth;
- factorWidth = _factorWidth;
-
- build();
- }
-
- public HistogramPlot2D(String n, Color c, double[][] _XY, double[] w, double _offsetCenter_perWidth, double _factorWidth) {
- super(n, c);
- XY = _XY;
- widths = w;
-
- autowidth = false;
- offsetCenter_perWidth = _offsetCenter_perWidth;
- factorWidth = _factorWidth;
-
- build();
- }
-
- private void build() {
- if (width_constant > 0) {
- topLeft = new double[XY.length][];
- topRight = new double[XY.length][];
- bottomLeft = new double[XY.length][];
- bottomRight = new double[XY.length][];
- for (int i = 0; i < XY.length; i++) {
- topLeft[i] = new double[]{XY[i][0] - factorWidth * width_constant / 2 + (offsetCenter_perWidth - 0.5) * width_constant, XY[i][1]};
- topRight[i] = new double[]{XY[i][0] + factorWidth * width_constant / 2 + (offsetCenter_perWidth - 0.5) * width_constant, XY[i][1]};
- bottomLeft[i] = new double[]{XY[i][0] - factorWidth * width_constant / 2 + (offsetCenter_perWidth - 0.5) * width_constant, 0};
- bottomRight[i] = new double[]{XY[i][0] + factorWidth * width_constant / 2 + (offsetCenter_perWidth - 0.5) * width_constant, 0};
- }
- } else {
- topLeft = new double[XY.length][];
- topRight = new double[XY.length][];
- bottomLeft = new double[XY.length][];
- bottomRight = new double[XY.length][];
- for (int i = 0; i < XY.length; i++) {
- topLeft[i] = new double[]{XY[i][0] - factorWidth * widths[i] / 2 + (offsetCenter_perWidth - 0.5) * widths[i], XY[i][1]};
- topRight[i] = new double[]{XY[i][0] + factorWidth * widths[i] / 2 + (offsetCenter_perWidth - 0.5) * widths[i], XY[i][1]};
- bottomLeft[i] = new double[]{XY[i][0] - factorWidth * widths[i] / 2 + (offsetCenter_perWidth - 0.5) * widths[i], 0};
- bottomRight[i] = new double[]{XY[i][0] + factorWidth * widths[i] / 2 + (offsetCenter_perWidth - 0.5) * widths[i], 0};
- }
- }
- }
-
- /*
- * public HistogramPlot2D(double[][] XY, Color c, String n, ProjectionBase
- * b) { super(XY, c, n, PlotPanel.HISTOGRAM, b);
- *
- * autowidth = true;
- *
- * topLeft = new double[datas.length][]; topRight = new
- * double[datas.length][]; bottomLeft = new double[datas.length][];
- * bottomRight = new double[datas.length][];
- *
- * Sorting sort = new Sorting(DoubleArray.getColumnCopy(datas, 0), false);
- * datas = DoubleArray.getRowsCopy(XY, sort.getIndex());
- *
- * topLeft[0] = new double[] { datas[0][0] + (datas[0][0] - datas[1][0]) /
- * 2, datas[0][1] }; topRight[0] = new double[] { (datas[0][0] +
- * datas[1][0]) / 2, datas[0][1] }; bottomLeft[0] = new double[] {
- * datas[0][0] + (datas[0][0] - datas[1][0]) / 2, 0 }; bottomRight[0] = new
- * double[] { (datas[0][0] + datas[1][0]) / 2, 0 }; for (int i = 1; i <
- * datas.length - 1; i++) { topLeft[i] = new double[] { (datas[i][0] +
- * datas[i - 1][0]) / 2, datas[i][1] }; topRight[i] = new double[] {
- * (datas[i][0] + datas[i + 1][0]) / 2, datas[i][1] }; bottomLeft[i] = new
- * double[] { (datas[i][0] + datas[i - 1][0]) / 2, 0 }; bottomRight[i] = new
- * double[] { (datas[i][0] + datas[i + 1][0]) / 2, 0 }; }
- * topLeft[datas.length - 1] = new double[] { (datas[datas.length - 1][0] +
- * datas[datas.length - 2][0]) / 2, datas[datas.length - 1][1] };
- * topRight[datas.length - 1] = new double[] { datas[datas.length - 1][0] +
- * (datas[datas.length - 1][0] - datas[datas.length - 2][0]) / 2,
- * datas[datas.length - 1][1] }; bottomLeft[datas.length - 1] = new double[] {
- * (datas[datas.length - 1][0] + datas[datas.length - 2][0]) / 2, 0 };
- * bottomRight[datas.length - 1] = new double[] { datas[datas.length - 1][0] +
- * (datas[datas.length - 1][0] - datas[datas.length - 2][0]) / 2, 0 }; }
- */
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length; i++) {
- draw.drawLine(bottomLeft[i], topLeft[i]);
- draw.drawLine(topLeft[i], topRight[i]);
- draw.drawLine(topRight[i], bottomRight[i]);
- draw.drawLine(bottomRight[i], bottomLeft[i]);
-
- if (fill_shape) {
- draw.fillPolygon(0.2f, bottomLeft[i], topLeft[i], topRight[i], bottomRight[i]);
- }
- }
- }
-
- @Override
- public void setData(double[][] d) {
- datapanel = null;
- XY = d;
- }
-
- @Override
- public double[][] getData() {
- return XY;
- }
-
- @Override
- public double[][] getBounds() {
- return new double[][]{Array.min(bottomLeft), Array.max(topRight)};
- }
-
- public void setDataWidth(double[] w) {
- widths = w;
- width_constant = -1;
- build();
- }
-
- public void setDataWidth(double w) {
- width_constant = w;
- build();
- }
-
- public double[] getDataWidth() {
- if (width_constant > 0) {
- widths = new double[XY.length];
- for (int i = 0; i < widths.length; i++) {
- widths[i] = width_constant;
- }
- }
- return widths;
- }
-
- public void setData(double[][] d, double[] w) {
- setData(d);
- setDataWidth(w);
- }
-
- public void setData(double[][] d, double w) {
- setData(d);
- setDataWidth(w);
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- for (int i = 0; i < XY.length; i++) {
- int[] screenCoord = draw.project(XY[i]);
-
- if ((screenCoord[0] + note_precision > screenCoordTest[0]) && (screenCoord[0] - note_precision < screenCoordTest[0])
- && (screenCoord[1] + note_precision > screenCoordTest[1]) && (screenCoord[1] - note_precision < screenCoordTest[1])) {
- return XY[i];
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- double[] X = new double[500];
- for (int i = 0; i < X.length; i++) {
- X[i] = Math.random() + Math.random();
- }
- Plot2DPanel p = new Plot2DPanel("SOUTH");
- p.addHistogramPlot("test", X, 10);
- new FrameView(p);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/HistogramPlot3D.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/HistogramPlot3D.java
deleted file mode 100644
index 8e316b2..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/HistogramPlot3D.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-
-public class HistogramPlot3D extends Plot {
-
- double[][] topNW;
- double[][] topNE;
- double[][] topSW;
- double[][] topSE;
- double[][] bottomNW;
- double[][] bottomNE;
- double[][] bottomSW;
- double[][] bottomSE;
- double[][] widths;
- double[] width_constant = {-1, -1};
- double[][] XY;
- boolean fill_shape = true;
-
- public HistogramPlot3D(String n, Color c, double[][] _XY, double[][] w) {
- super(n, c);
- XY = _XY;
- widths = w;
-
- build();
- }
-
- public HistogramPlot3D(String n, Color c, double[][] _XY, double wX, double wY) {
- super(n, c);
- XY = _XY;
- width_constant = new double[]{wX, wY};
-
- build();
- }
-
- public HistogramPlot3D(String n, Color c, double[][] _XY, double[] w) {
- super(n, c);
- XY = _XY;
- width_constant = w;
-
- build();
- }
-
- private void build() {
- if (width_constant[0] > 0) {
- topNW = new double[XY.length][];
- topNE = new double[XY.length][];
- topSW = new double[XY.length][];
- topSE = new double[XY.length][];
- bottomNW = new double[XY.length][];
- bottomNE = new double[XY.length][];
- bottomSW = new double[XY.length][];
- bottomSE = new double[XY.length][];
- for (int i = 0; i < XY.length; i++) {
- topNW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] + width_constant[1] / 2, XY[i][2]};
- topNE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] + width_constant[1] / 2, XY[i][2]};
- topSW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] - width_constant[1] / 2, XY[i][2]};
- topSE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] - width_constant[1] / 2, XY[i][2]};
- bottomNW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] + width_constant[1] / 2, 0};
- bottomNE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] + width_constant[1] / 2, 0};
- bottomSW[i] = new double[]{XY[i][0] - width_constant[0] / 2, XY[i][1] - width_constant[1] / 2, 0};
- bottomSE[i] = new double[]{XY[i][0] + width_constant[0] / 2, XY[i][1] - width_constant[1] / 2, 0};
- }
- } else {
- topNW = new double[XY.length][];
- topNE = new double[XY.length][];
- topSW = new double[XY.length][];
- topSE = new double[XY.length][];
- bottomNW = new double[XY.length][];
- bottomNE = new double[XY.length][];
- bottomSW = new double[XY.length][];
- bottomSE = new double[XY.length][];
- for (int i = 0; i < XY.length; i++) {
- topNW[i] = new double[]{XY[i][0] - widths[i][0] / 2, XY[i][1] + widths[i][1] / 2, XY[i][2]};
- topNE[i] = new double[]{XY[i][0] + widths[i][0] / 2, XY[i][1] + widths[i][1] / 2, XY[i][2]};
- topSW[i] = new double[]{XY[i][0] - widths[i][0] / 2, XY[i][1] - widths[i][1] / 2, XY[i][2]};
- topSE[i] = new double[]{XY[i][0] + widths[i][0] / 2, XY[i][1] - widths[i][1] / 2, XY[i][2]};
- bottomNW[i] = new double[]{XY[i][0] - widths[i][0] / 2, XY[i][1] + widths[i][1] / 2, 0};
- bottomNE[i] = new double[]{XY[i][0] + widths[i][0] / 2, XY[i][1] + widths[i][1] / 2, 0};
- bottomSW[i] = new double[]{XY[i][0] - widths[i][0] / 2, XY[i][1] - widths[i][1] / 2, 0};
- bottomSE[i] = new double[]{XY[i][0] + widths[i][0] / 2, XY[i][1] - widths[i][1] / 2, 0};
- }
- }
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- draw.canvas.includeInBounds(bottomSW[0]);
- draw.canvas.includeInBounds(topNE[XY.length - 1]);
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length; i++) {
- if (topNW[i][2] != bottomNW[i][2]) {
- draw.drawLine(topNW[i], topNE[i]);
- draw.drawLine(topNE[i], topSE[i]);
- draw.drawLine(topSE[i], topSW[i]);
- draw.drawLine(topSW[i], topNW[i]);
-
- draw.drawLine(bottomNW[i], bottomNE[i]);
- draw.drawLine(bottomNE[i], bottomSE[i]);
- draw.drawLine(bottomSE[i], bottomSW[i]);
- draw.drawLine(bottomSW[i], bottomNW[i]);
-
- draw.drawLine(bottomNW[i], topNW[i]);
- draw.drawLine(bottomNE[i], topNE[i]);
- draw.drawLine(bottomSE[i], topSE[i]);
- draw.drawLine(bottomSW[i], topSW[i]);
-
- if (fill_shape) {
- draw.fillPolygon(0.2f, topNW[i], topNE[i], topSE[i], topSW[i]);
- //draw.fillPolygon(bottomNW[i], bottomNE[i], bottomSE[i], bottomSW[i]);
- /*draw.fillPolygon(topNW[i], topNE[i], bottomNE[i], bottomNW[i]);
- draw.fillPolygon(topSW[i], topSE[i], bottomSE[i], bottomSW[i]);
- draw.fillPolygon(topNE[i], topSE[i], bottomSE[i], bottomNE[i]);
- draw.fillPolygon(topNW[i], topSW[i], bottomSW[i], bottomNW[i]);*/
- }
- }
- }
- }
-
- @Override
- public void setData(double[][] d) {
- datapanel = null;
- XY = d;
- }
-
- @Override
- public double[][] getData() {
- return XY;
- }
-
- @Override
- public double[][] getBounds() {
- return new double[][]{Array.min(bottomSW), Array.max(topNE)};
- }
-
- public void setDataWidth(double[][] w) {
- widths = w;
- }
-
- public void setDataWidth(double... w) {
- width_constant = w;
- build();
- }
-
- public double[][] getDataWidth() {
- if (width_constant[0] > 0) {
- widths = new double[XY.length][2];
- for (int i = 0; i < widths.length; i++) {
- widths[i][0] = width_constant[0];
- widths[i][1] = width_constant[1];
- }
- }
- return widths;
- }
-
- public void setData(double[][] d, double[][] w) {
- setData(d);
- widths = w;
- }
-
- public void setData(double[][] d, double... w) {
- setData(d);
- setDataWidth(w);
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- for (int i = 0; i < XY.length; i++) {
- int[] screenCoord = draw.project(XY[i]);
-
- if ((screenCoord[0] + note_precision > screenCoordTest[0]) && (screenCoord[0] - note_precision < screenCoordTest[0])
- && (screenCoord[1] + note_precision > screenCoordTest[1]) && (screenCoord[1] - note_precision < screenCoordTest[1])) {
- return XY[i];
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- double[][] XY = new double[500][2];
- for (int i = 0; i < XY.length; i++) {
- XY[i][0] = Math.random() + Math.random();
- XY[i][1] = Math.random() + Math.random();
- }
- Plot3DPanel p = new Plot3DPanel("SOUTH");
- p.addHistogramPlot("test", XY, 4, 6);
- new FrameView(p);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Label.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Label.java
deleted file mode 100644
index 9292538..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Label.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-import java.awt.Font;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-public class Label implements Plotable {
-
- protected double[] coord;
-
- protected double[] base_offset;
-
- protected String label;
-
- protected Color color;
-
- protected double cornerN = 0.5;
-
- protected double cornerE = 0.5;
-
- boolean visible = true;
-
- public double angle = 0;
-
- public Font font = AbstractDrawer.DEFAULT_FONT;
-
- // private static DecimalFormat dec = new DecimalFormat("##0.###E0");
-
- public Label(String l, Color col, double... c) {
- label = l;
- coord = c;
- color = col;
- }
-
- public Label(String l, double... c) {
- this(l, AbstractDrawer.DEFAULT_COLOR, c);
- }
-
- /**
- * show coord itself
- */
- public Label(double... c) {
- this(coordToString(c), AbstractDrawer.DEFAULT_COLOR, c);
- }
-
- public void setText(String _t) {
- label = _t;
- }
-
- public String getText() {
- return label;
- }
-
- public void setCoord(double... _c) {
- coord = _c;
- }
-
- public void setColor(Color c) {
- color = c;
- }
-
- public Color getColor() {
- return color;
- }
-
- /**
- * reference point center: 0.5, 0.5 lowerleft: 0,0 upperleft 1, 0 ...
- */
- public void setCorner(double north_south, double east_west) {
- cornerN = north_south;
- cornerE = east_west;
- }
-
- public void setVisible(boolean v) {
- visible = v;
- }
-
- public boolean getVisible() {
- return visible;
- }
-
- /**
- * shift by given screen coordinates offset
- */
- /*
- * public void setOffset(double[] offset) { double[] newCoord =
- * coord.getPlotCoordCopy(); for (int i = 0; i < newCoord.length; i++) {
- * newCoord[i] += offset[i]; } coord.setPlotCoord(newCoord); }
- */
-
- /**
- * see Text for formatted text output
- */
- public void plot(AbstractDrawer draw) {
- if (!visible) {
- return;
- }
-
- draw.setColor(color);
- draw.setFont(font);
- draw.setBaseOffset(base_offset);
- draw.setTextOffset(cornerE, cornerN);
- draw.setTextAngle(angle);
- draw.drawText(label, coord);
- draw.setBaseOffset(null);
- }
-
- public void rotate(double _angle) {
- angle = _angle;
- }
-
- public void setFont(Font _font) {
- font = _font;
- }
-
- public static double approx(double val, int decimal) {
- // double timesEn = val*Math.pow(10,decimal);
- // if (Math.rint(timesEn) == timesEn) {
- // return val;
- // } else {
- // to limit precision loss, you need to separate cases where decimal<0
- // and >0
- // if you don't you'll have this : approx(10000.0,-4) => 10000.00000001
- if (decimal < 0) {
- return Math.rint(val / Math.pow(10, -decimal)) * Math.pow(10, -decimal);
- } else {
- return Math.rint(val * Math.pow(10, decimal)) / Math.pow(10, decimal);
- }
- // }
- }
-
- public static String coordToString(double... c) {
- StringBuffer sb = new StringBuffer("(");
- for (int i = 0; i < c.length; i++) {
- sb.append(approx(c[i], 2)).append(",");
- }
- // sb.append(dec.format(c.getPlotCoordCopy()[i])).append(",");
-
- sb.setLength(sb.length() - 1);
- if (sb.length() > 0) {
- sb.append(")");
- }
-
- return sb.toString();
- }
-
- public Font getFont() {
- return font;
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/LayerPlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/LayerPlot.java
deleted file mode 100644
index 472cdc1..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/LayerPlot.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Created on 5 juil. 07 by richet
- */
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.DataPanel;
-import org.xbib.graphics.graph.jmathplot.canvas.PlotCanvas;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-
-public abstract class LayerPlot extends Plot {
-
- Plot plot;
-
- public LayerPlot(String name, Plot p) {
- super(name, p.color);
- plot = p;
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- return null;
- }
-
- @Override
- public double[][] getBounds() {
- return plot.getBounds();
- }
-
- @Override
- public DataPanel getDataPanel(PlotCanvas plotCanvas) {
- return null;
- }
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Line.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Line.java
deleted file mode 100644
index fc6d58f..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Line.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-
-public class Line implements Plotable {
-
- protected double[][] extrem = new double[2][];
-
- protected Color color;
-
- protected Color gradientColor;
-
- boolean visible = true;
-
- public Line(Color col, double[] c1, double[] c2) {
- extrem[0] = c1;
- extrem[1] = c2;
- color = col;
- }
-
- public void setColor(Color c) {
- color = c;
- }
-
- public Color getColor() {
- return color;
- }
-
- public void setVisible(boolean v) {
- visible = v;
- }
-
- public boolean getVisible() {
- return visible;
- }
-
- public void plot(AbstractDrawer draw) {
- if (!visible) {
- return;
- }
-
- draw.setColor(color);
- if (gradientColor != null) {
- draw.setGradient(extrem[0], color, extrem[1], gradientColor);
- }
- draw.drawLine(extrem[0], extrem[1]);
- if (gradientColor != null) {
- draw.resetGradient();
- }
- }
-
- public Color getGradientColor() {
- return gradientColor;
- }
-
- public void setGradientColor(Color c) {
- this.gradientColor = c;
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/LinePlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/LinePlot.java
deleted file mode 100644
index 7ac246b..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/LinePlot.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-public class LinePlot extends ScatterPlot {
-
- public boolean draw_dot = false;
-
- public LinePlot(String n, Color c, boolean[][] _pattern, double[][] _XY) {
- super(n, c, _pattern, _XY);
- }
-
- public LinePlot(String n, Color c, int _type, int _radius, double[][] _XY) {
- super(n, c, _type, _radius, _XY);
- }
-
- public LinePlot(String n, Color c, double[][] _XY) {
- super(n, c, _XY);
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- if (draw_dot) {
- super.plot(draw, c);
- }
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length - 1; i++) {
- if (!anyNaN(XY[i]) && !anyNaN(XY[i + 1])) {
- draw.drawLine(XY[i], XY[i + 1]);
- }
- }
- }
-
- boolean anyNaN(double[] xy) {
- for (int i = 0; i < xy.length; i++) {
- if (Double.isNaN(xy[i])) {
- return true;
- }
- }
- return false;
- }
-
- public static void main(String[] args) {
- Plot2DPanel p2 = new Plot2DPanel();
-
- double[][] XYZ = new double[100][2];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = 2 * Math.PI * (double) j / XYZ.length;
- XYZ[j][1] = Math.sin(XYZ[j][0]);
- }
- XYZ[50][0] = Double.NaN;
- p2.addLinePlot("sin", XYZ);
-
-
- p2.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p2).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- Plot3DPanel p = new Plot3DPanel();
-
- XYZ = new double[100][3];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = 2 * Math.PI * (double) j / XYZ.length;
- XYZ[j][1] = Math.sin(XYZ[j][0]);
- XYZ[j][2] = Math.sin(XYZ[j][0]) * Math.cos(XYZ[j][1]);
- }
- p.addLinePlot("toto", XYZ);
-
- p.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Noteable.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Noteable.java
deleted file mode 100644
index 0b74203..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Noteable.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-
-public interface Noteable {
-
- double[] isSelected(int[] screenCoord, AbstractDrawer draw);
-
- void note(AbstractDrawer draw);
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/PaintImage.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/PaintImage.java
deleted file mode 100644
index 5bc487a..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/PaintImage.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Created on 5 sept. 2005 by richet
- */
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Image;
-
-public class PaintImage implements Plotable {
-
- public interface Paintable {
-
- void paint(Graphics g);
- }
-
- protected Paintable source;
- protected Image img;
- protected double[] xyzSW, xyzSE, xyzNW;
- protected boolean visible = true;
- protected float alpha;
-
- public PaintImage(Paintable _source, float _alpha, double[] _xyzSW, double[] _xyzSE, double[] _xyzNW) {
- source = _source;
-
- xyzSW = _xyzSW;
- xyzSE = _xyzSE;
- xyzNW = _xyzNW;
- alpha = _alpha;
- }
-
- public void plot(AbstractDrawer draw) {
- if (!visible) {
- return;
- }
-
- if (img == null) {
- img = draw.canvas.createImage(draw.canvas.getWidth(), draw.canvas.getHeight());
- source.paint(img.getGraphics());
- }
-
- draw.drawImage(img, alpha, xyzSW, xyzSE, xyzNW);
- }
-
- public void setVisible(boolean v) {
- visible = v;
- }
-
- public boolean getVisible() {
- return visible;
- }
-
- public void setColor(Color c) {
- throw new IllegalArgumentException("method not available for this Object: PlotImage");
- }
-
- public Color getColor() {
- return null;
- }
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Plot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Plot.java
deleted file mode 100644
index e8b564f..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Plot.java
+++ /dev/null
@@ -1,255 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.DataPanel;
-import org.xbib.graphics.graph.jmathplot.panel.MatrixTablePanel;
-import org.xbib.graphics.graph.jmathplot.canvas.PlotCanvas;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.util.LinkedList;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JColorChooser;
-import javax.swing.JPanel;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-public abstract class Plot implements Plotable, Noteable, Editable {
-
- public String name;
- public Color color;
- public boolean visible = true;
- public LinkedList layers;
- public boolean noted = false;
- public double[] coordNoted;
- //public boolean forcenoted = false;
- public int note_precision = 5;
-
- public Plot(String n, Color c) {
- name = n;
- color = c;
- layers = new LinkedList();
-
- }
-
- public void clearLayers() {
- layers.clear();
- }
-
- public void addLayer(LayerPlot q) {
- layers.add(q);
- }
-
- public void addQuantile(QuantileLayerPlot q) {
- layers.add(q);
- }
-
- public void addQuantile(int a, double r, double[] q, boolean symetric) {
- layers.add(new QuantileLayerPlot(this, a, q, r, symetric));
- }
-
- public void addQuantile(int a, double r, double q, boolean symetric) {
- layers.add(new QuantileLayerPlot(this, a, q, r, symetric));
- }
-
- public void addQuantiles(int a, double[][] q) {
- layers.add(new DensityLayerPlot(this, a, q));
- }
-
- public void addQuantiles(int a, double[] q) {
- layers.add(new DensityLayerPlot(this, a, q));
- }
-
- public void addGaussQuantiles(int a, double[] s) {
- layers.add(new GaussianDensityLayerPlot(this, a, s));
- }
-
- public void addGaussQuantiles(int a, double s) {
- layers.add(new GaussianDensityLayerPlot(this, a, s));
- }
-
- /*public void addQuantiles(double[][][] q,boolean _symetric) {
- for (int i = 0; i < q[0].length; i++) {
- addQuantile(i, Array.getColumnCopy(q, i, 0),_symetric);
- addQuantile(i, Array.getColumnCopy(q, i, 1),_symetric);
- }
- }*/
-
- /*public void addQuantiles(double[][] q,boolean _symetric) {
- for (int i = 0; i < q[0].length; i++) {
- addQuantile(i, Array.getColumnCopy(q, i),_symetric);
- }
- }*/
- public void addVector(double[][] v) {
- layers.add(new VectorLayerPlot(this, v));
- }
-
- public abstract void setData(double[][] d);
-
- public abstract double[][] getData();
-
- public double[] getBounds(int axis) {
- return Array.getColumnCopy(getBounds(), axis);
- }
-
- /**
- * This method should be abstract, but for backward compatibility, here is a basic impl.
- */
- public double[][] getBounds() {
- return Array.mergeRows(Array.min(getData()), Array.max(getData()));
- }
-
- public void setVisible(boolean v) {
- visible = v;
- }
-
- public boolean getVisible() {
- return visible;
- }
-
- public void setName(String n) {
- name = n;
- }
-
- public String getName() {
- return name;
- }
-
- /*
- * public String getType() { return type; }
- */
- public Color getColor() {
- return color;
- }
-
- public void setColor(Color c) {
- color = c;
- }
-
- public abstract double[] isSelected(int[] screenCoordTest, AbstractDrawer draw);
-
- public void note(AbstractDrawer draw) {
- plot(draw, PlotCanvas.NOTE_COLOR);
- plotLayerPlots(draw, PlotCanvas.NOTE_COLOR);
- }
-
- public void noteCoord(AbstractDrawer draw, double[] coordNoted) {
- if (coordNoted == null) {
- return;
- }
-
- draw.setColor(PlotCanvas.NOTE_COLOR);
- draw.drawCoordinate(coordNoted);
- draw.drawShadowedText(Array.cat("\n", draw.canvas.reverseMapedData(coordNoted)), .5f, coordNoted);
- }
-
- public abstract void plot(AbstractDrawer draw, Color c);
-
- public void plot(AbstractDrawer draw) {
- //if (layers.size() > 0)
- plotLayerPlots(draw, color);
- //else
- plot(draw, color);
- }
-
- public void plotLayerPlots(AbstractDrawer draw, Color c) {
- for (int i = 0; i < layers.size(); i++) {
- layers.get(i).plot(draw, c);
- }
-
- }
-
- public void edit(Object src) {
- ((PlotCanvas) src).displayDataFrame(((PlotCanvas) src).getPlotIndex(this));
- }
-
- public void editnote(AbstractDrawer draw) {
- plot(draw, PlotCanvas.EDIT_COLOR);
- plotLayerPlots(draw, PlotCanvas.EDIT_COLOR);
- }
-
- public DataPanel datapanel = null;
- public PlotCanvas plotCanvas;
-
- public DataPanel getDataPanel(PlotCanvas plotCanvas) {
- this.plotCanvas = plotCanvas;
- if (datapanel == null) {
- datapanel = new DefaultDataPanel(this);
- }
- return datapanel;
- }
-
- public class DefaultDataPanel extends DataPanel {
-
- private static final long serialVersionUID = 1L;
- MatrixTablePanel XY;
- JCheckBox visible;
- JButton color;
- JPanel plottoolspanel;
- Plot plot;
- //DataFrame dframe;
-
- public DefaultDataPanel(/*DataFrame _dframe,*/Plot _plot) {
- plot = _plot;
- //dframe = _dframe;
- visible = new JCheckBox("Visible");
- visible.setSelected(plot.getVisible());
- color = new JButton();
- color.setBackground(plot.getColor());
- XY = new MatrixTablePanel(plotCanvas.reverseMapedData(plot.getData()));
-
- visible.addChangeListener(new ChangeListener() {
-
- public void stateChanged(ChangeEvent e) {
- plot.setVisible(visible.isSelected());
- plotCanvas.linkedLegendPanel.updateLegends();
- /*dframe.*/
- plotCanvas.repaint();
- }
- });
- color.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- Color c = JColorChooser.showDialog(plotCanvas, "Choose plot color", plot.getColor());
- color.setBackground(c);
- plot.setColor(c);
- plotCanvas.linkedLegendPanel.updateLegends();
- /*dframe.*/
- plotCanvas.linkedLegendPanel.repaint();
- /*dframe.*/
- plotCanvas.repaint();
- }
- });
-
- this.setLayout(new BorderLayout());
- plottoolspanel = new JPanel();
- plottoolspanel.add(visible);
- plottoolspanel.add(color);
- this.add(plottoolspanel, BorderLayout.NORTH);
- this.add(XY, BorderLayout.CENTER);
- }
-
- @Override
- protected void toWindow() {
- XY.toWindow();
- }
-
- @Override
- public void toClipBoard() {
- XY.toClipBoard();
- }
-
- @Override
- public void toASCIIFile(File file) {
- XY.toASCIIFile(file);
- }
-
- public String getText() {
- return XY.getText();
- }
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Plotable.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Plotable.java
deleted file mode 100644
index d6b50b0..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/Plotable.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-
-public interface Plotable {
-
- void plot(AbstractDrawer draw);
-
- void setVisible(boolean v);
-
- boolean getVisible();
-
- void setColor(Color c);
-
- Color getColor();
-
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/QuantileLayerPlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/QuantileLayerPlot.java
deleted file mode 100644
index 98e3203..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/QuantileLayerPlot.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-
-public class QuantileLayerPlot extends LayerPlot {
-
- public static int WIDTH = 2;
-
- int axe;
-
- double quantileRate;
-
- Color gradC;
-
- double main_data_constant = 0;
-
- public boolean symetric = false;
-
- double[] Q;
-
- //public static double DEFAULT_RATE=1.0;
-
- /*public QuantilePlot(Plot p, int a, double[] q, boolean _symetric) {
- this(p, a, q, DEFAULT_RATE,_symetric);
-
- }*/
-
- public QuantileLayerPlot(Plot p, int a, double q, double r, boolean _symetric) {
- this(p, a, null, r, true);
- main_data_constant = q;
- }
-
- /*public QuantilePlot(Plot p, int a, double q) {
- this(p, a, q, DEFAULT_RATE,true);
- }*/
-
- /**
- * Build a quantile plot based on given plot. The quantile is drawn as a linear gradient from the base plot dots.
- *
- * @param p base plot
- * @param a axis number of quantile : 0=X quantile, 1=Y quantile, 2=Z quantile
- * @param q array of quantiles values
- * @param r rate of the quantile. The gradient line length is q/r
- * @param _symetric if yes, quantiles are drawn on both negative and positive sides of base plot dots
- */
- public QuantileLayerPlot(Plot p, int a, double[] q, double r, boolean _symetric) {
- super(r + " quantile of " + p.name, p);
- if (q != null) {
- Array.checkLength(q, p.getData().length);
- }
- Q = q;
- axe = a;
- quantileRate = r;
- symetric = _symetric;
-
- }
-
- public double getQuantilesValue(int numCoord) {
- return Q[numCoord];
- }
-
- public int getAxe() {
- return axe;
- }
-
- public double getQuantileRate() {
- return quantileRate;
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!plot.visible) {
- return;
- }
-
- draw.setColor(c);
- gradC = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (255 * (1 - quantileRate)));
-
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- draw.setLineWidth(WIDTH);
- if (main_data_constant == 0) {
- for (int i = 0; i < plot.getData().length; i++) {
- double[] d = Array.getRowCopy(plot.getData(), i);
- d[axe] += Q[i];///quantileRate;
- draw.setGradient(plot.getData()[i], c, d, gradC);
- draw.drawLine(plot.getData()[i], d);
- // draw.drawDot(d, RADIUS/*(int)(RADIUS*quantileRate)*/);
-
- if (symetric) {
- d[axe] -= 2 * Q[i];///quantileRate;
- draw.setGradient(plot.getData()[i], c, d, gradC);
- draw.drawLine(plot.getData()[i], d);
- // draw.drawDot(d, RADIUS/*(int)(RADIUS*quantileRate)*/);
- }
- }
- } else {
- for (int i = 0; i < plot.getData().length; i++) {
- double[] d = Array.getRowCopy(plot.getData(), i);
- d[axe] += main_data_constant;///quantileRate;
- draw.setGradient(plot.getData()[i], c, d, gradC);
- draw.drawLine(plot.getData()[i], d);
- // draw.drawDot(d, shape/*RADIUS/*(int)(RADIUS*quantileRate)*/);
-
- if (symetric) {
- d[axe] -= 2 * main_data_constant;///quantileRate;
- draw.setGradient(plot.getData()[i], c, d, gradC);
- draw.drawLine(plot.getData()[i], d);
- // draw.drawDot(d, RADIUS/*(int)(RADIUS*quantileRate)*/);
- }
- }
- }
- draw.resetGradient();
- draw.setLineWidth(AbstractDrawer.DEFAULT_LINE_WIDTH);
-
- }
-
- @Override
- public void setData(double[][] d) {
- Q = d[0];
- }
-
- @Override
- public double[][] getData() {
- return new double[][]{Q};
- }
-
-
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/RasterImage.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/RasterImage.java
deleted file mode 100644
index f2f1407..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/RasterImage.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Image;
-import java.awt.Toolkit;
-import java.io.File;
-import javax.swing.JFrame;
-
-public class RasterImage implements Plotable {
-
- File source;
- Image img;
-
- double[] xyzSW, xyzSE, xyzNW;
-
- boolean visible = true;
- float alpha;
-
- public RasterImage(File _source, float _alpha, double[] _xyzSW, double[] _xyzSE, double[] _xyzNW) {
- source = _source;
- img = Toolkit.getDefaultToolkit().getImage(source.getPath());
- xyzSW = _xyzSW;
- xyzSE = _xyzSE;
- xyzNW = _xyzNW;
- alpha = _alpha;
- }
-
- public void plot(AbstractDrawer draw) {
- if (!visible) {
- return;
- }
-
- draw.drawImage(img, alpha, xyzSW, xyzSE, xyzNW);
- }
-
- public void setVisible(boolean v) {
- visible = v;
- }
-
- public boolean getVisible() {
- return visible;
- }
-
- public void setColor(Color c) {
- throw new IllegalArgumentException("method not available for this Object: PlotImage");
- }
-
- public Color getColor() {
- return null;
- }
-
- public static void main(String[] args) {
- Plot2DPanel p2 = new Plot2DPanel();
- for (int i = 0; i < 1; i++) {
- double[][] XYZ = new double[10][2];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] =/*1 + */Math.random();
- XYZ[j][1] = /*100 * */Math.random();
- }
- p2.addScatterPlot("toto" + i, XYZ);
- }
-
- p2.addPlotable(new RasterImage(new File("test.gif"), 0.8f, new double[]{0.2, 0.5}, new double[]{1.2, 0.8}, new double[]{0.2, 1.1}));
-
- p2.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p2).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
-
- Plot3DPanel p = new Plot3DPanel();
- for (int i = 0; i < 1; i++) {
- double[][] XYZ = new double[10][3];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = /*1 +*/ Math.random();
- XYZ[j][1] = /*100 **/ Math.random();
- XYZ[j][2] = /*0.0001 **/ Math.random();
- }
- p.addScatterPlot("toto" + i, XYZ);
- }
-
- p.addPlotable(new RasterImage(new File("test.gif"), 0.5f, new double[]{0.0, 0.0, 0.0}, new double[]{1, 0, 0.0}, new double[]{0.0, 0, 1}));
- p.addPlotable(new RasterImage(new File("test.gif"), 0.5f, new double[]{0.0, 0.0, 0.0}, new double[]{0, 1, 0.0}, new double[]{0, 0.0, 1}));
- p.addPlotable(new RasterImage(new File("test.gif"), 0.5f, new double[]{0.0, 0.0, 0.0}, new double[]{1, 0, 0}, new double[]{0, 1, 0}));
- // TODO this following case is not totally supported...
- //p.addPlotable(new PlotImage(new File("test.jpg"),0.5f, new double[] {1,0,0},new double[] {1,1,0},new double[] {0,0,1}));
-
-
- p.setLegendOrientation(PlotPanel.SOUTH);
- p.setPreferredSize(new Dimension(600, 600));
- new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/ScatterPlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/ScatterPlot.java
deleted file mode 100644
index 0adf7c2..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/ScatterPlot.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.Plot3DPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.canvas.PlotCanvas;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import org.xbib.graphics.graph.jmathplot.utils.FastMath;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-public class ScatterPlot extends Plot {
-
- private int type;
- private int radius;
- private boolean[][] pattern;
- private boolean use_pattern;
- double[][] XY;
- private String[] tags;
-
- public ScatterPlot(String n, Color c, boolean[][] _pattern, double[][] _XY) {
- super(n, c);
- XY = _XY;
- use_pattern = true;
- pattern = _pattern;
- }
-
- public ScatterPlot(String n, Color c, int _type, int _radius, double[][] _XY) {
- super(n, c);
- XY = _XY;
- use_pattern = false;
- type = _type;
- radius = _radius;
- }
-
- public ScatterPlot(String n, Color c, double[][] _XY) {
- this(n, c, AbstractDrawer.ROUND_DOT, AbstractDrawer.DEFAULT_DOT_RADIUS, _XY);
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- draw.setColor(c);
- if (use_pattern) {
- draw.setDotType(AbstractDrawer.PATTERN_DOT);
- draw.setDotPattern(pattern);
- } else {
- draw.setDotRadius(radius);
- if (type == AbstractDrawer.CROSS_DOT) {
- draw.setDotType(AbstractDrawer.CROSS_DOT);
- } else {
- draw.setDotType(AbstractDrawer.ROUND_DOT);
- }
- }
-
- for (int i = 0; i < XY.length; i++) {
- draw.drawDot(XY[i]);
- }
- }
-
- public void setDotPattern(int t) {
- type = t;
- use_pattern = false;
- }
-
- public void setDotPattern(boolean[][] t) {
- use_pattern = true;
- pattern = t;
- }
-
- @Override
- public void setData(double[][] d) {
- datapanel = null;
- XY = d;
- }
-
- @Override
- public double[][] getData() {
- return XY;
- }
-
- @Override
- public double[][] getBounds() {
- return Array.mergeRows(Array.min(XY), Array.max(XY));
- }
-
- public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
- for (int i = 0; i < XY.length; i++) {
- int[] screenCoord = draw.project(XY[i]);
-
- if (FastMath.abs(screenCoord[0] - screenCoordTest[0]) < note_precision && FastMath.abs(screenCoord[1] - screenCoordTest[1]) < note_precision) {
- return XY[i];
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- Plot2DPanel p2 = new Plot2DPanel();
- for (int i = 0; i < 3; i++) {
- double[][] XYZ = new double[10][2];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = /*1 + */ Math.random();
- XYZ[j][1] = /*100 * */ Math.random();
- }
- p2.addScatterPlot("toto" + i, XYZ);
- }
-
- p2.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p2).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- Plot3DPanel p = new Plot3DPanel();
- String[] tags = null;
- for (int i = 0; i < 3; i++) {
- double[][] XYZ = new double[10][3];
- tags = new String[10];
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = /*1 +*/ 2.5 * Math.random();
- XYZ[j][1] = /*100 **/ Math.random();
- XYZ[j][2] = /*0.0001 **/ Math.random();
- tags[j] = "tags " + j;
- }
- p.addScatterPlot("toto" + i, XYZ);
- }
- ((ScatterPlot) p.getPlot(0)).setTags(tags);
-
- p.setLegendOrientation(PlotPanel.SOUTH);
- new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-
- /**
- * @param tags the tags to set
- */
- public void setTags(String[] tags) {
- datapanel = null;
- this.tags = tags;
- }
-
- @Override
- public void noteCoord(AbstractDrawer draw, double[] coordNoted) {
- if (coordNoted == null) {
- return;
- }
-
- if (tags == null) {
- super.noteCoord(draw, coordNoted);
- } else {
- draw.setColor(PlotCanvas.NOTE_COLOR);
- for (int i = 0; i < XY.length; i++) {
- if (tags.length > i) {
- if (Array.equals(XY[i], coordNoted)) {
- draw.drawShadowedText(tags[i], .5f, coordNoted);
- }
- }
- }
- }
- //draw.drawCoordinate(coordNoted);
- //draw.drawText(Array.cat(draw.canvas.reverseMapedData(coordNoted)), coordNoted);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/StaircasePlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/StaircasePlot.java
deleted file mode 100644
index 337f612..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/StaircasePlot.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-public class StaircasePlot extends ScatterPlot {
-
- public boolean link = true;
-
- public StaircasePlot(String n, Color c, boolean[][] _pattern, double[][] _XY) {
- super(n, c, _pattern, _XY);
- }
-
- public StaircasePlot(String n, Color c, int _type, int _radius, double[][] _XY) {
- super(n, c, _type, _radius, _XY);
- }
-
- public StaircasePlot(String n, Color c, double[][] _XY) {
- super(n, c, _XY);
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!visible) {
- return;
- }
-
- //System.out.println(Array.toString(XY));
-
- draw.setColor(c);
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
- for (int i = 0; i < XY.length - 1; i++) {
- double[] begin = XY[i].clone();
- double[] end = XY[i + 1].clone();
- end[end.length - 1] = XY[i][end.length - 1];
- draw.drawLine(begin, end);
- }
-
- //System.out.println(Array.toString(XY));
-
- if (link) {
- for (int i = 0; i < XY.length - 2; i++) {
- double[] begin = XY[i + 1].clone();
- double[] end = XY[i + 1].clone();
- begin[begin.length - 1] = XY[i][begin.length - 1];
- draw.drawLine(begin, end);
- }
- }
- //System.out.println(Array.toString(XY));
-
- }
-
- public static void main(String[] args) {
- Plot2DPanel p = new Plot2DPanel();
-
- double[] X = new double[10];
- double[] Y = new double[10];
- for (int j = 0; j < X.length; j++) {
- X[j] = j;
- Y[j] = Math.random();
- }
- p.addStaircasePlot("toto", X, Y);
-
- new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/VectorLayerPlot.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/VectorLayerPlot.java
deleted file mode 100644
index 829c828..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/VectorLayerPlot.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.xbib.graphics.graph.jmathplot;
-
-import org.xbib.graphics.graph.jmathplot.panel.FrameView;
-import org.xbib.graphics.graph.jmathplot.panel.Plot2DPanel;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import java.awt.Color;
-import javax.swing.JFrame;
-
-/**
- * @author Yann RICHET
- * @version 1.0
- */
-
-/**
- * Layer to add a vector field to an existing Plot
- */
-public class VectorLayerPlot extends LayerPlot {
-
- public static int RADIUS = 5;
-
- double[][] V;
-
- /**
- * Create a vector fiels based on data of a plot
- *
- * @param p Base plot to support vector field
- * @param v Vector field of same lenght that p data
- */
- public VectorLayerPlot(Plot p, double[][] v) {
- super("Vector of " + p.name, p);
- if (v != null) {
- Array.checkRowDimension(v, p.getData().length);
- Array.checkColumnDimension(v, p.getData()[0].length);
- }
- V = v;
-
- }
-
- @Override
- public void setData(double[][] v) {
- V = v;
- }
-
- @Override
- public double[][] getData() {
- return V;
- }
-
- public void plot(AbstractDrawer draw, Color c) {
- if (!plot.visible) {
- return;
- }
-
- draw.setColor(c);
-
- draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
-
- for (int i = 0; i < plot.getData().length; i++) {
- double[] d = Array.getRowCopy(plot.getData(), i);
- for (int j = 0; j < d.length; j++) {
- d[j] += V[i][j];
- }
- draw.drawLine(plot.getData()[i], d);
- //TODO: draw arrow at position d
-
- }
-
- }
-
- public static void main(String[] args) {
- Plot2DPanel p2 = new Plot2DPanel();
- double[][] XYZ = new double[100][2];
- double[][] dXYZ = new double[100][2];
-
- for (int j = 0; j < XYZ.length; j++) {
- XYZ[j][0] = Math.random() * 10;
- XYZ[j][1] = Math.random() * 10;
- dXYZ[j][0] = 1.0 / Math.sqrt(1 + Math.log(XYZ[j][0]) * Math.log(XYZ[j][0]));
- dXYZ[j][1] = Math.log(XYZ[j][0]) / Math.sqrt(1 + Math.log(XYZ[j][0]) * Math.log(XYZ[j][0]));
- }
- p2.addScatterPlot("toto", XYZ);
-
- p2.addVectortoPlot(0, dXYZ);
- new FrameView(p2).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/Plot2DCanvas.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/Plot2DCanvas.java
deleted file mode 100755
index 7e5e4a8..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/Plot2DCanvas.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.xbib.graphics.graph.jmathplot.canvas;
-
-import static org.xbib.graphics.graph.jmathplot.Base.LINEAR;
-import static org.xbib.graphics.graph.jmathplot.utils.Array.getColumnCopy;
-import static org.xbib.graphics.graph.jmathplot.utils.Array.getColumnsRangeCopy;
-import static org.xbib.graphics.graph.jmathplot.utils.Array.increment;
-import static org.xbib.graphics.graph.jmathplot.utils.Array.mergeColumns;
-import static org.xbib.graphics.graph.jmathplot.utils.Histogram.histogram_classes;
-import static org.xbib.graphics.graph.jmathplot.utils.Histogram.histogram_classes_2D;
-import org.xbib.graphics.graph.jmathplot.Base;
-import org.xbib.graphics.graph.jmathplot.BasePlot;
-import org.xbib.graphics.graph.jmathplot.BarPlot;
-import org.xbib.graphics.graph.jmathplot.BoxPlot2D;
-import org.xbib.graphics.graph.jmathplot.CloudPlot2D;
-import org.xbib.graphics.graph.jmathplot.HistogramPlot2D;
-import org.xbib.graphics.graph.jmathplot.LinePlot;
-import org.xbib.graphics.graph.jmathplot.ScatterPlot;
-import org.xbib.graphics.graph.jmathplot.StaircasePlot;
-import org.xbib.graphics.graph.jmathplot.render.AWTDrawer2D;
-import java.awt.Color;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-public class Plot2DCanvas extends PlotCanvas {
-
- // public final static String PARALLELHISTOGRAM = "PARALLELHISTOGRAM";
-
- private static final long serialVersionUID = 1L;
-
- public Plot2DCanvas() {
- super();
- ActionMode = ZOOM;
- }
-
- public Plot2DCanvas(Base b, BasePlot bp) {
- super(b, bp);
- ActionMode = ZOOM;
- }
-
- public Plot2DCanvas(double[] min, double[] max, String[] axesScales, String[] axesLabels) {
- super(min, max, axesScales, axesLabels);
- ActionMode = ZOOM;
- }
-
- public void initDrawer() {
- draw = new AWTDrawer2D(this);
- }
-
- public void initBasenGrid(double[] min, double[] max) {
- initBasenGrid(min, max, new String[]{LINEAR, LINEAR}, new String[]{"X", "Y"});
- }
-
- public void initBasenGrid() {
- initBasenGrid(new double[]{0, 0}, new double[]{1, 1});
- }
-
- private static double[][] convertY(double[] XY) {
- double[] x = increment(XY.length, 1, 1);
- return mergeColumns(x, XY);
- }
-
- private static double[][] convertXY(double[]... XY) {
- if (XY.length == 2 && XY[0].length != 2) {
- return mergeColumns(XY[0], XY[1]);
- } else {
- return XY;
- }
- }
-
- public int addScatterPlot(String name, Color c, double[] Y) {
- return addPlot(new ScatterPlot(name, c, convertY(Y)));
- }
-
- public int addScatterPlot(String name, Color c, double[][] XY) {
- return addPlot(new ScatterPlot(name, c, convertXY(XY)));
- }
-
- public int addScatterPlot(String name, Color c, double[] X, double[] Y) {
- return addPlot(new ScatterPlot(name, c, convertXY(X, Y)));
- }
-
- public int addLinePlot(String name, Color c, double[] Y) {
- return addPlot(new LinePlot(name, c, convertY(Y)));
- }
-
- public int addLinePlot(String name, Color c, double[][] XY) {
- return addPlot(new LinePlot(name, c, convertXY(XY)));
- }
-
- public int addLinePlot(String name, Color c, double[] X, double[] Y) {
- return addPlot(new LinePlot(name, c, convertXY(X, Y)));
- }
-
- public int addBarPlot(String name, Color c, double[] Y) {
- return addPlot(new BarPlot(name, c, convertY(Y)));
- }
-
- public int addBarPlot(String name, Color c, double[][] XY) {
- return addPlot(new BarPlot(name, c, convertXY(XY)));
- }
-
- public int addBarPlot(String name, Color c, double[] X, double[] Y) {
- return addPlot(new BarPlot(name, c, convertXY(X, Y)));
- }
-
- public int addStaircasePlot(String name, Color c, double[] Y) {
- return addPlot(new StaircasePlot(name, c, convertY(Y)));
- }
-
- public int addStaircasePlot(String name, Color c, double[][] XY) {
- return addPlot(new StaircasePlot(name, c, convertXY(XY)));
- }
-
- public int addStaircasePlot(String name, Color c, double[] X, double[] Y) {
- return addPlot(new StaircasePlot(name, c, convertXY(X, Y)));
- }
-
-
- public int addBoxPlot(String name, Color c, double[][] XY, double[][] dX) {
- return addPlot(new BoxPlot2D(XY, dX, c, name));
- }
-
- public int addBoxPlot(String name, Color c, double[][] XYdX) {
- return addPlot(new BoxPlot2D(getColumnsRangeCopy(XYdX, 0, 1), getColumnsRangeCopy(XYdX, 2, 3), c, name));
- }
-
- public int addHistogramPlot(String name, Color c, double[][] XY, double[] dX) {
- return addPlot(new HistogramPlot2D(name, c, XY, dX));
- }
-
- public int addHistogramPlot(String name, Color c, double[][] XY, double dX) {
- return addPlot(new HistogramPlot2D(name, c, XY, dX));
- }
-
- public int addHistogramPlot(String name, Color c, double[][] XYdX) {
- return addPlot(new HistogramPlot2D(name, c, getColumnsRangeCopy(XYdX, 0, 1), getColumnCopy(XYdX, 2)));
- }
-
- public int addHistogramPlot(String name, Color c, double[] X, int n) {
- double[][] XY = histogram_classes(X, n);
- return addPlot(new HistogramPlot2D(name, c, XY, XY[1][0] - XY[0][0]));
- }
-
- public int addHistogramPlot(String name, Color c, double[] X, double... bounds) {
- double[][] XY = histogram_classes(X, bounds);
- return addPlot(new HistogramPlot2D(name, c, XY, XY[1][0] - XY[0][0]));
- }
-
- public int addHistogramPlot(String name, Color c, double[] X, double min, double max, int n) {
- double[][] XY = histogram_classes(X, min, max, n);
- return addPlot(new HistogramPlot2D(name, c, XY, XY[1][0] - XY[0][0]));
- }
-
- public int addCloudPlot(String name, Color c, double[][] sampleXY, int nX, int nY) {
- double[][] XYh = histogram_classes_2D(sampleXY, nX, nY);
- return addPlot(new CloudPlot2D(name, c, XYh, XYh[1][0] - XYh[0][0], XYh[nX][1] - XYh[0][1]));
- }
-
- public static void main(String[] args) {
- /*
- * Plot2DPanel p2d = new Plot2DPanel(DoubleArray.random(10, 2), "plot
- * 1", PlotPanel.SCATTER); new FrameView(p2d);
- * p2d.addPlot(DoubleArray.random(10, 2), "plot 2", PlotPanel.SCATTER);
- * p2d.grid.getAxe(0).darkLabel.setCorner(0.5, -10);
- * p2d.grid.getAxe(1).darkLabel.setCorner(0, -0.5);
- */
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/Plot3DCanvas.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/Plot3DCanvas.java
deleted file mode 100644
index dc554fc..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/Plot3DCanvas.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package org.xbib.graphics.graph.jmathplot.canvas;
-
-import static org.xbib.graphics.graph.jmathplot.Base.LINEAR;
-import static org.xbib.graphics.graph.jmathplot.utils.Array.getColumnsRangeCopy;
-import static org.xbib.graphics.graph.jmathplot.utils.Array.getSubMatrixRangeCopy;
-import static org.xbib.graphics.graph.jmathplot.utils.Array.mergeColumns;
-import static org.xbib.graphics.graph.jmathplot.utils.Histogram.histogram_classes_2D;
-import static org.xbib.graphics.graph.jmathplot.utils.Histogram.histogram_classes_3D;
-import org.xbib.graphics.graph.jmathplot.Base;
-import org.xbib.graphics.graph.jmathplot.BasePlot;
-import org.xbib.graphics.graph.jmathplot.BarPlot;
-import org.xbib.graphics.graph.jmathplot.BoxPlot3D;
-import org.xbib.graphics.graph.jmathplot.CloudPlot3D;
-import org.xbib.graphics.graph.jmathplot.GridPlot3D;
-import org.xbib.graphics.graph.jmathplot.HistogramPlot3D;
-import org.xbib.graphics.graph.jmathplot.LinePlot;
-import org.xbib.graphics.graph.jmathplot.ScatterPlot;
-import org.xbib.graphics.graph.jmathplot.render.AWTDrawer;
-import org.xbib.graphics.graph.jmathplot.render.AWTDrawer3D;
-import org.xbib.graphics.graph.jmathplot.render.Projection3D;
-import java.awt.Color;
-import java.awt.event.MouseEvent;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-public class Plot3DCanvas extends PlotCanvas {
-
- private static final long serialVersionUID = 1L;
- public final static int ROTATION = 2;
-
- public Plot3DCanvas() {
- super();
- ActionMode = ROTATION;
- }
-
- public Plot3DCanvas(Base b) {
- super(b, new BasePlot(b, "X", "Y", "Z"));
- ActionMode = ROTATION;
- }
-
- public Plot3DCanvas(Base b, BasePlot bp) {
- super(b, bp);
- ActionMode = ROTATION;
- }
-
- public Plot3DCanvas(double[] min, double[] max, String[] axesScales, String[] axesLabels) {
- super(min, max, axesScales, axesLabels);
- ActionMode = ROTATION;
- }
-
- public void initDrawer() {
- draw = new AWTDrawer3D(this);
- }
-
- public void initBasenGrid(double[] min, double[] max) {
- initBasenGrid(min, max, new String[]{LINEAR, LINEAR, LINEAR}, new String[]{"X", "Y", "Z"});
- }
-
- public void initBasenGrid() {
- initBasenGrid(new double[]{0, 0, 0}, new double[]{1, 1, 1});
- }
-
- private static double[][] convertXYZ(double[]... XYZ) {
- if (XYZ.length == 3 && XYZ[0].length != 3) {
- return mergeColumns(XYZ[0], XYZ[1], XYZ[2]);
- } else {
- return XYZ;
- }
- }
-
- public void setDefaultZoom(double zoom_factor) {
- ((Projection3D) ((AWTDrawer3D) draw).projection).factor = zoom_factor;
- }
-
- public int addScatterPlot(String name, Color c, double[][] XYZ) {
- return addPlot(new ScatterPlot(name, c, convertXYZ(XYZ)));
- }
-
- public int addScatterPlot(String name, Color c, double[] X, double[] Y, double[] Z) {
- return addPlot(new ScatterPlot(name, c, convertXYZ(X, Y, Z)));
- }
-
- public int addLinePlot(String name, Color c, double[][] XYZ) {
- return addPlot(new LinePlot(name, c, convertXYZ(XYZ)));
- }
-
- public int addLinePlot(String name, Color c, double[] X, double[] Y, double[] Z) {
- return addPlot(new LinePlot(name, c, convertXYZ(X, Y, Z)));
- }
-
- public int addBarPlot(String name, Color c, double[][] XYZ) {
- return addPlot(new BarPlot(name, c, convertXYZ(XYZ)));
- }
-
- public int addBarPlot(String name, Color c, double[] X, double[] Y, double[] Z) {
- return addPlot(new BarPlot(name, c, convertXYZ(X, Y, Z)));
- }
-
- public int addBoxPlot(String name, Color c, double[][] XY, double[][] dX) {
- return addPlot(new BoxPlot3D(XY, dX, c, name));
- }
-
- public int addBoxPlot(String name, Color c, double[][] XYdX) {
- return addPlot(new BoxPlot3D(getColumnsRangeCopy(XYdX, 0, 2), getColumnsRangeCopy(XYdX, 3, 5), c, name));
- }
-
- public int addHistogramPlot(String name, Color c, double[][] XY, double[][] dX) {
- return addPlot(new HistogramPlot3D(name, c, XY, dX));
- }
-
- public int addHistogramPlot(String name, Color c, double[][] XYdX) {
- return addPlot(new HistogramPlot3D(name, c, getColumnsRangeCopy(XYdX, 0, 2), getColumnsRangeCopy(XYdX, 3, 4)));
- }
-
- public int addHistogramPlot(String name, Color c, double[][] XY, int nX, int nY) {
- double[][] XYZ = histogram_classes_2D(XY, nX, nY);
- return addPlot(new HistogramPlot3D(name, c, XYZ, XYZ[1][0] - XYZ[0][0], XYZ[nX][1] - XYZ[0][1]));
- }
-
- public int addHistogramPlot(String name, Color c, double[][] XY, double[] boundsX, double[] boundsY) {
- double[][] XYZ = histogram_classes_2D(XY, boundsX, boundsY);
- return addPlot(new HistogramPlot3D(name, c, XYZ, XYZ[1][0] - XYZ[0][0], XYZ[boundsX.length - 1][1] - XYZ[0][1]));
- }
-
- public int addHistogramPlot(String name, Color c, double[][] XY, double minX, double maxX, int nX, double minY, double maxY, int nY) {
- double[][] XYZ = histogram_classes_2D(XY, minX, maxX, nX, minY, maxY, nY);
- return addPlot(new HistogramPlot3D(name, c, XYZ, XYZ[1][0] - XYZ[0][0], XYZ[nX][1] - XYZ[0][1]));
- }
-
- public int addGridPlot(String name, Color c, double[] X, double[] Y, double[][] Z) {
- return addPlot(new GridPlot3D(name, c, X, Y, Z));
- }
-
- public int addGridPlot(String name, Color c, double[][] XYZMatrix) {
- double[] X = new double[XYZMatrix[0].length - 1];
- System.arraycopy(XYZMatrix[0], 1, X, 0, XYZMatrix[0].length - 1);
- double[] Y = new double[XYZMatrix.length - 1];
- for (int i = 0; i < Y.length; i++) {
- Y[i] = XYZMatrix[i + 1][0];
- }
- double[][] Z = getSubMatrixRangeCopy(XYZMatrix, 1, XYZMatrix.length - 1, 1, XYZMatrix[0].length - 1);
-
- return addGridPlot(name, c, X, Y, Z);
- }
-
- public int addCloudPlot(String name, Color c, double[][] sampleXYZ, int nX, int nY, int nZ) {
- double[][] XYZh = histogram_classes_3D(sampleXYZ, nX, nY, nZ);
- return addPlot(new CloudPlot3D(name, c, XYZh, XYZh[1][0] - XYZh[0][0], XYZh[nX][1] - XYZh[0][1], XYZh[nX][2] - XYZh[0][2]));
- }
-
- public void mouseDragged(MouseEvent e) {
- //System.out.println("PlotCanvas.mouseDragged");
- if (ActionMode == ROTATION) {
- dragging = true;
- /*
- * System.out.println("PlotCanvas.mouseDragged"); System.out.println("
- * mouseClick = [" + mouseClick[0] + " " + mouseClick[1] + "]");
- * System.out.println(" mouseCurent = [" + mouseCurent[0] + " " +
- * mouseCurent[1] + "]");
- */
- mouseCurent[0] = e.getX();
- mouseCurent[1] = e.getY();
- e.consume();
-
- int[] t = new int[]{mouseCurent[0] - mouseClick[0], mouseCurent[1] - mouseClick[1]};
- ((AWTDrawer3D) draw).rotate(t, new int[]{getWidth(), getHeight()});
- mouseClick[0] = mouseCurent[0];
- mouseClick[1] = mouseCurent[1];
- repaint();
- } else {
- super.mouseDragged(e);
- }
- }
-
- public void rotate(double theta, double phi) {
- Projection3D proj3d = ((Projection3D) ((AWTDrawer) draw).projection);
- proj3d.rotate(proj3d.theta + theta, proj3d.phi + phi);
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/PlotCanvas.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/PlotCanvas.java
deleted file mode 100755
index 19228b5..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/canvas/PlotCanvas.java
+++ /dev/null
@@ -1,970 +0,0 @@
-package org.xbib.graphics.graph.jmathplot.canvas;
-
-import static org.xbib.graphics.graph.jmathplot.Base.LINEAR;
-import static org.xbib.graphics.graph.jmathplot.Base.LOGARITHM;
-import static org.xbib.graphics.graph.jmathplot.Base.STRINGS;
-import org.xbib.graphics.graph.jmathplot.BaseLabel;
-import org.xbib.graphics.graph.jmathplot.Label;
-import org.xbib.graphics.graph.jmathplot.frame.DataFrame;
-import org.xbib.graphics.graph.jmathplot.frame.LegendPanel;
-import org.xbib.graphics.graph.jmathplot.frame.ScalesFrame;
-import org.xbib.graphics.graph.jmathplot.Base;
-import org.xbib.graphics.graph.jmathplot.BaseDependant;
-import org.xbib.graphics.graph.jmathplot.BasePlot;
-import org.xbib.graphics.graph.jmathplot.Plotable;
-import org.xbib.graphics.graph.jmathplot.Plot;
-import org.xbib.graphics.graph.jmathplot.render.AWTDrawer;
-import org.xbib.graphics.graph.jmathplot.render.AbstractDrawer;
-import org.xbib.graphics.graph.jmathplot.utils.Array;
-import org.xbib.graphics.graph.jmathplot.utils.FastMath;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.RenderingHints;
-import java.awt.Stroke;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseWheelEvent;
-import java.awt.event.MouseWheelListener;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Set;
-import javax.imageio.ImageIO;
-import javax.swing.ImageIcon;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-
-public abstract class PlotCanvas extends JPanel implements MouseListener, MouseMotionListener, ComponentListener, BaseDependant, MouseWheelListener {
-
- //public int[] panelSize = new int[] { 400, 400 };
- public Base base;
- protected AbstractDrawer draw;
- protected BasePlot grid;
- public LegendPanel linkedLegendPanel;
- public LinkedList plots;
- public LinkedList objects;
-
- // ///////////////////////////////////////////
- // ////// Constructor & inits ////////////////
- // ///////////////////////////////////////////
- public PlotCanvas() {
- initPanel();
- initBasenGrid();
- initDrawer();
- }
-
- public PlotCanvas(Base b, BasePlot bp) {
- initPanel();
- initBasenGrid(b, bp);
- initDrawer();
- }
-
- public PlotCanvas(double[] min, double[] max) {
- initPanel();
- initBasenGrid(min, max);
- initDrawer();
- }
-
- public PlotCanvas(double[] min, double[] max, String[] axesScales, String[] axesLabels) {
- initPanel();
- initBasenGrid(min, max, axesScales, axesLabels);
- initDrawer();
- }
-
- @Override
- public boolean isOptimizedDrawingEnabled() {
- return true;
- }
-
- public void attachLegend(LegendPanel lp) {
- linkedLegendPanel = lp;
- }
-
- private void initPanel() {
- objects = new LinkedList();
- plots = new LinkedList();
-
- setDoubleBuffered(true);
-
- //setSize(panelSize[0], panelSize[1]);
- //setPreferredSize(new Dimension(panelSize[0], panelSize[1]));
- setBackground(Color.white);
-
- addComponentListener(this);
- addMouseListener(this);
- addMouseMotionListener(this);
- addMouseWheelListener(this);
- }
-
- public abstract void initDrawer();
-
- public void initBasenGrid(double[] min, double[] max, String[] axesScales, String[] axesLabels) {
- base = new Base(min, max, axesScales);
- grid = new BasePlot(base, axesLabels);
- // grid.getAxe(0).getDarkLabel().setCorner(0.5,-1);
- // grid.getAxe(1).getDarkLabel().setCorner(0,-0.5);
- }
-
- public abstract void initBasenGrid(double[] min, double[] max);
-
- public abstract void initBasenGrid();
-
- public void initBasenGrid(Base b, BasePlot bp) {
- base = b;
- grid = bp;
-
- }
-
- // ///////////////////////////////////////////
- // ////// set actions ////////////////////////
- // ///////////////////////////////////////////
- public void setActionMode(int am) {
- ActionMode = am;
- }
-
- public void setNoteCoords(boolean b) {
- allowNoteCoord = b;
- }
-
- public void setEditable(boolean b) {
- allowEdit = b;
- }
-
- public boolean getEditable() {
- return allowEdit;
- }
-
- public void setNotable(boolean b) {
- allowNote = b;
- }
-
- public boolean getNotable() {
- return allowNote;
- }
-
- // ///////////////////////////////////////////
- // ////// set/get elements ///////////////////
- // ///////////////////////////////////////////
- public LinkedList getPlots() {
- return plots;
- }
-
- public Plot getPlot(int i) {
- return plots.get(i);
- }
-
- public int getPlotIndex(Plot p) {
- for (int i = 0; i < plots.size(); i++) {
- if (getPlot(i) == p) {
- return i;
- }
- }
- return -1;
- }
-
- public LinkedList getPlotables() {
- return objects;
- }
-
- public Plotable getPlotable(int i) {
- return objects.get(i);
- }
-
- public BasePlot getGrid() {
- return grid;
- }
-
- public String[] getAxisScales() {
- return base.getAxesScales();
- }
-
- public void setAxisLabels(String... labels) {
- grid.setLegend(labels);
- repaint();
- }
-
- public void setAxisLabel(int axe, String label) {
- grid.setLegend(axe, label);
- repaint();
- }
-
- public void setAxisScales(String... scales) {
- base.setAxesScales(scales);
- setAutoBounds();
- }
-
- public void setAxiScale(int axe, String scale) {
- base.setAxesScales(axe, scale);
- setAutoBounds(axe);
- }
-
- public void setFixedBounds(double[] min, double[] max) {
- base.setFixedBounds(min, max);
- resetBase();
- repaint();
- }
-
- public void setFixedBounds(int axe, double min, double max) {
- base.setFixedBounds(axe, min, max);
- resetBase();
- repaint();
- }
-
- public void includeInBounds(double... into) {
- boolean changed = base.includeInBounds(into);
- if (!changed) {
- return;
- }
- grid.resetBase();
- repaint();
- }
-
- public void includeInBounds(Plot plot) {
- boolean changed = base.includeInBounds(Array.min(plot.getBounds()));
- changed = changed | base.includeInBounds(Array.max(plot.getBounds()));
- if (!changed) {
- return;
- }
- resetBase();
- repaint();
- }
-
- public void setAutoBounds() {
- if (plots.size() > 0) {
- Plot plot0 = this.getPlot(0);
- base.setRoundBounds(Array.min(plot0.getBounds()), Array.max(plot0.getBounds()));
- } else { // build default min and max bounds
- double[] min = new double[base.dimension];
- double[] max = new double[base.dimension];
- for (int i = 0; i < base.dimension; i++) {
- if (base.getAxeScale(i).equalsIgnoreCase(LINEAR)) {
- min[i] = 0.0;
- max[i] = 1.0;
- } else if (base.getAxeScale(i).equalsIgnoreCase(LOGARITHM)) {
- min[i] = 1.0;
- max[i] = 10.0;
- }
- }
- base.setRoundBounds(min, max);
- }
- for (int i = 1; i < plots.size(); i++) {
- Plot ploti = this.getPlot(i);
- base.includeInBounds(Array.min(ploti.getBounds()));
- base.includeInBounds(Array.max(ploti.getBounds()));
- }
- resetBase();
- repaint();
- }
-
- public void setAutoBounds(int axe) {
- if (plots.size() > 0) {
- Plot plot0 = this.getPlot(0);
- base.setRoundBounds(axe, Array.min(plot0.getBounds())[axe], Array.max(plot0.getBounds())[axe]);
- } else { // build default min and max bounds
- double min = 0.0;
- double max = 0.0;
- if (base.getAxeScale(axe).equalsIgnoreCase(LINEAR) | base.getAxeScale(axe).equalsIgnoreCase(STRINGS)) {
- min = 0.0;
- max = 1.0;
- } else if (base.getAxeScale(axe).equalsIgnoreCase(LOGARITHM)) {
- min = 1.0;
- max = 10.0;
- }
- base.setRoundBounds(axe, min, max);
- }
-
- for (int i = 1; i < plots.size(); i++) {
- Plot ploti = this.getPlot(i);
- base.includeInBounds(axe, Array.min(ploti.getBounds())[axe]);
- base.includeInBounds(axe, Array.max(ploti.getBounds())[axe]);
- }
- resetBase();
- repaint();
- }
-
- public void resetBase() {
- // System.out.println("PlotCanvas.resetBase");
- draw.resetBaseProjection();
- grid.resetBase();
-
- for (int i = 0; i < objects.size(); i++) {
- if (objects.get(i) instanceof BaseDependant) {
- ((BaseDependant) (objects.get(i))).resetBase();
- }
- }
- repaint();
- }
-
- // ///////////////////////////////////////////
- // ////// add/remove elements ////////////////
- // ///////////////////////////////////////////
- public void addLabel(String text, Color c, double... where) {
- addPlotable(new Label(text, c, where));
- }
-
- public void addBaseLabel(String text, Color c, double... where) {
- addPlotable(new BaseLabel(text, c, where));
- }
-
- public void addPlotable(Plotable p) {
- objects.add(p);
- // resetBase();
- repaint();
- }
-
- public void removePlotable(Plotable p) {
- objects.remove(p);
- repaint();
- }
-
- public void removePlotable(int i) {
- objects.remove(i);
- repaint();
- }
-
- public void removeAllPlotables() {
- objects.clear();
- repaint();
- }
-
- boolean adjustBounds = true;
-
- public void setAdjustBounds(boolean adjust) {
- adjustBounds = adjust;
- }
-
- public boolean getAdjustBounds() {
- return adjustBounds;
- }
-
- public int addPlot(Plot newPlot) {
- plots.add(newPlot);
- if (linkedLegendPanel != null) {
- linkedLegendPanel.updateLegends();
- }
- if (plots.size() == 1) {
- setAutoBounds();
- } else {
- if (adjustBounds) {
- includeInBounds(newPlot);
- } else {
- repaint();
- }
- }
- return plots.size() - 1;
- }
-
- public void setPlot(int I, Plot p) {
- plots.set(I, p);
- if (linkedLegendPanel != null) {
- linkedLegendPanel.updateLegends();
- }
- repaint();
- }
-
- public void changePlotData(int I, double[]... XY) {
- getPlot(I).setData(XY);
- if (adjustBounds) {
- includeInBounds(getPlot(I));
- } else {
- repaint();
- }
- }
-
- public void changePlotName(int I, String name) {
- getPlot(I).setName(name);
- if (linkedLegendPanel != null) {
- linkedLegendPanel.updateLegends();
- }
- repaint();
- }
-
- public void changePlotColor(int I, Color c) {
- getPlot(I).setColor(c);
- if (linkedLegendPanel != null) {
- linkedLegendPanel.updateLegends();
- }
- repaint();
- }
-
- public void removePlot(int I) {
- plots.remove(I);
- if (linkedLegendPanel != null) {
- linkedLegendPanel.updateLegends();
- }
- if (plots.size() != 0) {
- if (adjustBounds) {
- setAutoBounds();
- } else {
- repaint();
- }
- }
-
- }
-
- public void removePlot(Plot p) {
- plots.remove(p);
- if (linkedLegendPanel != null) {
- linkedLegendPanel.updateLegends();
- }
- if (plots.size() != 0) {
- if (adjustBounds) {
- setAutoBounds();
- }
- }
-
- }
-
- public void removeAllPlots() {
- plots.clear();
- if (linkedLegendPanel != null) {
- linkedLegendPanel.updateLegends();
- }
- clearNotes();
- }
-
- public void addVectortoPlot(int numPlot, double[][] v) {
- getPlot(numPlot).addVector(v);
- }
-
- /*public void addQuantiletoPlot(int numPlot, boolean _symetric, double[]... q) {
- getPlot(numPlot).addQuantiles(q, _symetric);
- }*/
- public void addQuantiletoPlot(int numPlot, int numAxe, double rate, boolean symetric, double[] q) {
- getPlot(numPlot).addQuantile(numAxe, rate, q, symetric);
- }
-
- public void addQuantiletoPlot(int numPlot, int numAxe, double rate, boolean symetric, double q) {
- getPlot(numPlot).addQuantile(numAxe, rate, q, symetric);
- }
-
- public void addQuantilestoPlot(int numPlot, int numAxe, double[][] q) {
- getPlot(numPlot).addQuantiles(numAxe, q);
- }
-
- public void addQuantilestoPlot(int numPlot, int numAxe, double[] q) {
- getPlot(numPlot).addQuantiles(numAxe, q);
- }
-
- public void addGaussQuantilestoPlot(int numPlot, int numAxe, double[] s) {
- getPlot(numPlot).addGaussQuantiles(numAxe, s);
- }
-
- public void addGaussQuantilestoPlot(int numPlot, int numAxe, double s) {
- getPlot(numPlot).addGaussQuantiles(numAxe, s);
- }
-
- // ///////////////////////////////////////////
- // ////// call for toolbar actions ///////////
- // ///////////////////////////////////////////
- public void toGraphicFile(File file) throws IOException {
-
- Image image = createImage(getWidth(), getHeight());
- paint(image.getGraphics());
- image = new ImageIcon(image).getImage();
-
- BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
- Graphics g = bufferedImage.createGraphics();
- g.drawImage(image, 0, 0, Color.WHITE, null);
- g.dispose();
-
- try {
- ImageIO.write(bufferedImage, "PNG", file);
- } catch (IllegalArgumentException ex) {
- }
- }
-
- JFrame scalesFrame = new ScalesFrame(this);
-
- public void setScalesFrame(JFrame scalesFrame) {
- this.scalesFrame = scalesFrame;
- }
-
- public void displayScalesFrame() {
- scalesFrame.setVisible(true);
- }
-
- DataFrame dataFrame = new DataFrame(this);
-
- public void setDataFrame(DataFrame dataFrame) {
- this.dataFrame = dataFrame;
- }
-
- public void displayDataFrame(int i) {
- dataFrame.selectIndex(i);
- }
-
- public void displayDataFrame() {
- displayDataFrame(0);
- }
-
- boolean mapset = false;
-
- public void resetMapData() {
- for (int i = 0; i < grid.getAxis().length; i++) {
- grid.getAxis()[i].setStringMap(null);
- setAxiScale(i, Base.LINEAR);
- }
- mapset = false;
- }
-
- public double[][] mapData(Object[][] data) {
- //System.out.println("mapData:" + Array.cat(data));
-
- double[][] mapeddata = new double[data.length][data[0].length];
-
- if (!mapset) {
- for (int j = 0; j < data[0].length; j++) {
- if (!Array.isDouble(data[0][j].toString())) {
- //System.out.println(data[0][j].toString() + " is not a double");
- setAxiScale(j, Base.STRINGS);
-
- ArrayList string_array_j = new ArrayList(data.length);
- for (int i = 0; i < data.length; i++) {
- string_array_j.add(data[i][j].toString());
- }
-
- grid.getAxis(j).setStringMap(Array.mapStringArray(string_array_j));
- grid.getAxis(j).init();
-
- for (int i = 0; i < data.length; i++) {
- mapeddata[i][j] = grid.getAxis(j).getStringMap().get(data[i][j].toString());
- }
-
- //System.out.println("Axe " + j + ":" + Array.toString(grid.getAxe(j).getStringMap()));
- initReverseMap(j);
- } else {
- //System.out.println(data[0][j].toString() + " is a double");
- //System.out.println("Axe " + j + ": double[]");
- for (int i = 0; i < data.length; i++) {
- mapeddata[i][j] = Double.valueOf(data[i][j].toString());
- }
- }
- }
- mapset = true;
- } else {
- for (int j = 0; j < data[0].length; j++) {
- if (!Array.isDouble(data[0][j].toString())) {
- //System.out.println(data[0][j].toString() + " is not a double");
- if (base.getAxeScale(j).equals(Base.STRINGS)) {
- for (int i = 0; i < data.length; i++) {
- if (!grid.getAxis(j).getStringMap().containsKey(data[i][j].toString())) {
- Set s = grid.getAxis(j).getStringMap().keySet();
- ArrayList string_array_j = new ArrayList(s.size() + 1);
- string_array_j.addAll(s);
- string_array_j.add(data[i][j].toString());
- grid.getAxis(j).setStringMap(Array.mapStringArray(string_array_j));
-
- //System.out.println("Axe " + j + ":" + Array.toString(grid.getAxe(j).getStringMap()));
- initReverseMap(j);
- }
- mapeddata[i][j] = grid.getAxis(j).getStringMap().get(data[i][j].toString());
- }
- } else {
- throw new IllegalArgumentException("The mapping of this PlotPanel was not set on axis " + j);
- }
- } else {
- //System.out.println(data[0][j].toString() + " is a double");
- //System.out.println("Axe " + j + ": double[]");
- for (int i = 0; i < data.length; i++) {
- mapeddata[i][j] = Double.valueOf(data[i][j].toString());
- }
- }
- }
- }
- return mapeddata;
- }
-
- public Object[][] reverseMapedData(double[][] mapeddata) {
- Object[][] stringdata = new Object[mapeddata.length][mapeddata[0].length];
-
- for (int i = 0; i < mapeddata.length; i++) {
- stringdata[i] = reverseMapedData(mapeddata[i]);
- }
-
- return stringdata;
- }
-
- public Object[] reverseMapedData(double[] mapeddata) {
- Object[] stringdata = new Object[mapeddata.length];
-
- if (reversedMaps == null) {
- reversedMaps = new HashMap[grid.getAxis().length];
- }
-
- for (int j = 0; j < mapeddata.length; j++) {
- if (reversedMaps[j] != null) {
- stringdata[j] = reversedMaps[j].get(mapeddata[j]);
- } else {
- stringdata[j] = mapeddata[j];
- }
- }
-
- return stringdata;
- }
-
- HashMap[] reversedMaps;
-
- private void initReverseMap(int j) {
- if (reversedMaps == null) {
- reversedMaps = new HashMap[grid.getAxis().length];
- }
-
- if (grid.getAxis(j) != null) {
- reversedMaps[j] = Array.reverseStringMap(grid.getAxis(j).getStringMap());
- }
- }
-
- // ///////////////////////////////////////////
- // ////// Paint method ///////////////////////
- // ///////////////////////////////////////////
- // anti-aliasing constant
- final protected static RenderingHints AALIAS = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- public static Color NOTE_COLOR = Color.DARK_GRAY;
- public static Color EDIT_COLOR = Color.BLACK;
- public boolean allowEdit = true;
- public boolean allowNote = true;
- public boolean allowNoteCoord = true;
-
- public void paint(Graphics gcomp) {
- // System.out.println("PlotCanvas.paint");
-
- Graphics2D gcomp2D = (Graphics2D) gcomp;
-
- // anti-aliasing methods
- gcomp2D.addRenderingHints(AALIAS);
- gcomp2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-
- gcomp2D.setColor(getBackground());
- gcomp2D.fillRect(0, 0, getSize().width, getSize().height);
-
- draw.initGraphics(gcomp2D);
-
- // draw plot
- grid.plot(draw);
-
- for (int i = 0; i < plots.size(); i++) {
- getPlot(i).plot(draw);
- if (linkedLegendPanel != null) {
- linkedLegendPanel.nonote(i);
- }
- }
-
- for (int i = 0; i < objects.size(); i++) {
- getPlotable(i).plot(draw);
- }
-
- if (drawRect != null) {
- gcomp2D.setColor(Color.black);
- gcomp2D.setStroke(rectStroke);
- gcomp2D.drawRect(drawRect[0], drawRect[1], drawRect[2], drawRect[3]);
- }
-
- // draw note
- if (allowNote) {
- /*if (allowNoteCoord && coordNoted != null) {
- draw.setColor(NOTE_COLOR);
- draw.drawCoordinate(coordNoted);
- draw.drawText(Array.cat(reverseMapedData(coordNoted)), coordNoted);
- }*/
- for (int i = 0; i < plots.size(); i++) {
- if (getPlot(i).noted) {
- if (linkedLegendPanel != null) {
- linkedLegendPanel.note(i);
- }
- getPlot(i).note(draw);
- //return;
- }
- if (allowNoteCoord && getPlot(i).coordNoted != null) {
- getPlot(i).noteCoord(draw, getPlot(i).coordNoted);
- }
- }
- }
- }
-
- // ///////////////////////////////////////////
- // ////// Listeners //////////////////////////
- // ///////////////////////////////////////////
- public final static int ZOOM = 0;
- public final static int TRANSLATION = 1;
- public int ActionMode;
- protected boolean dragging = false;
- protected int[] mouseCurent = new int[2];
- protected int[] mouseClick = new int[2];
-
- public void clearNotes() {
- for (int i = 0; i < plots.size(); i++) {
- getPlot(i).coordNoted = null;
- }
- repaint();
- }
-
- public void mousePressed(MouseEvent e) {
- //System.out.println("PlotCanvas.mousePressed");
- /*
- * System.out.println("PlotCanvas.mousePressed"); System.out.println("
- * mouseClick = [" + mouseClick[0] + " " + mouseClick[1] + "]");
- * System.out.println(" mouseCurent = [" + mouseCurent[0] + " " +
- * mouseCurent[1] + "]");
- */
- mouseCurent[0] = e.getX();
- mouseCurent[1] = e.getY();
- e.consume();
- mouseClick[0] = mouseCurent[0];
- mouseClick[1] = mouseCurent[1];
- }
-
- int[] drawRect = null;
- final Stroke rectStroke = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
-
- public void mouseDragged(MouseEvent e) {
- //System.out.println("PlotCanvas.mouseDragged");
-
- dragging = true;
- /*
- * System.out.println("PlotCanvas.mouseDragged"); System.out.println("
- * mouseClick = [" + mouseClick[0] + " " + mouseClick[1] + "]");
- * System.out.println(" mouseCurent = [" + mouseCurent[0] + " " +
- * mouseCurent[1] + "]");
- */
- mouseCurent[0] = e.getX();
- mouseCurent[1] = e.getY();
- e.consume();
- switch (ActionMode) {
- case TRANSLATION:
- draw.translate(mouseCurent[0] - mouseClick[0], mouseCurent[1] - mouseClick[1]);
- mouseClick[0] = mouseCurent[0];
- mouseClick[1] = mouseCurent[1];
- repaint();
- break;
- case ZOOM:
- int x = FastMath.min(mouseClick[0], mouseCurent[0]);
- int y = FastMath.min(mouseClick[1], mouseCurent[1]);
- int w = FastMath.abs(mouseCurent[0] - mouseClick[0]);
- int h = FastMath.abs(mouseCurent[1] - mouseClick[1]);
- if (drawRect == null) {
- drawRect = new int[4];
- }
- drawRect[0] = x;
- drawRect[1] = y;
- drawRect[2] = w;
- drawRect[3] = h;
- repaint(); //repaint(x - 1, y - 1, w + 2, h + 2);
- break;
- }
- //repaint();
- }
-
- public void mouseReleased(MouseEvent e) {
- //System.out.println("PlotCanvas.mouseReleased");
-
- /*
- * System.out.println("PlotCanvas.mouseReleased"); System.out.println("
- * mouseClick = [" + mouseClick[0] + " " + mouseClick[1] + "]");
- * System.out.println(" mouseCurent = [" + mouseCurent[0] + " " +
- * mouseCurent[1] + "]");
- */
- mouseCurent[0] = e.getX();
- mouseCurent[1] = e.getY();
- e.consume();
- switch (ActionMode) {
- case ZOOM:
- if (FastMath.abs(mouseCurent[0] - mouseClick[0]) > 10 && FastMath.abs(mouseCurent[1] - mouseClick[1]) > 10) {
- int[] origin = {FastMath.min(mouseClick[0], mouseCurent[0]), FastMath.min(mouseClick[1], mouseCurent[1])};
- double[] ratio = {FastMath.abs((double) (mouseCurent[0] - mouseClick[0]) / (double) getWidth()),
- FastMath.abs((double) (mouseCurent[1] - mouseClick[1]) / (double) getHeight())
- };
- draw.dilate(origin, ratio);
- drawRect = null;
- repaint();
- } else {
- drawRect = null;
- repaint();
- }
- break;
- }
- //repaint();
- dragging = false;
- }
-
- public void mouseClicked(MouseEvent e) {
- //System.out.println("PlotCanvas.mouseClicked");
-
- /*
- * System.out.println("PlotCanvas.mouseClicked"); System.out.println("
- * mouseClick = [" + mouseClick[0] + " " + mouseClick[1] + "]");
- * System.out.println(" mouseCurent = [" + mouseCurent[0] + " " +
- * mouseCurent[1] + "]");
- */
- mouseCurent[0] = e.getX();
- mouseCurent[1] = e.getY();
- e.consume();
- mouseClick[0] = mouseCurent[0];
- mouseClick[1] = mouseCurent[1];
-
- if (allowEdit) {
- if (e.getModifiers() == MouseEvent.BUTTON1_MASK && e.getClickCount() > 1) {
- for (int i = 0; i < grid.getAxis().length; i++) {
- if (grid.getAxis(i).isSelected(mouseClick, draw) != null) {
- grid.getAxis(i).edit(this);
- return;
- }
- }
-
- for (int i = 0; i < plots.size(); i++) {
- if (getPlot(i).isSelected(mouseClick, draw) != null) {
- getPlot(i).edit(this);
- return;
- }
- }
- }
- }
-
- if (!dragging && allowNote) {
- for (int i = 0; i < plots.size(); i++) {
- double[] _coordNoted = getPlot(i).isSelected(mouseClick, draw);
- if (e.getModifiers() == MouseEvent.BUTTON1_MASK) {
- if (_coordNoted != null) {
- getPlot(i).noted = !getPlot(i).noted;
- } else {
- getPlot(i).noted = false;
- }
- } else if (e.getModifiers() == MouseEvent.BUTTON3_MASK) {
- if (_coordNoted != null) {
- if (getPlot(i).coordNoted != null) {
- boolean alreadyNoted = true;
- for (int j = 0; j < _coordNoted.length; j++) {
- alreadyNoted = alreadyNoted && _coordNoted[j] == getPlot(i).coordNoted[j];
- }
- if (alreadyNoted) {
- getPlot(i).coordNoted = null;
- } else {
- getPlot(i).coordNoted = _coordNoted;
- }
- } else {
- getPlot(i).coordNoted = _coordNoted;
- }
- }
- }
- }
- repaint();
- } else {
- dragging = false;
- }
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mouseMoved(MouseEvent e) {
- mouseCurent[0] = e.getX();
- mouseCurent[1] = e.getY();
- e.consume();
- for (int i = 0; i < plots.size(); i++) {
- if (getPlot(i).noted) {
- double[] _coordNoted = getPlot(i).isSelected(mouseCurent, draw);
- if (_coordNoted != null) {
- getPlot(i).coordNoted = _coordNoted;
- repaint();
- }
- }
- }
-
- //System.out.println("PlotCanvas.mouseMoved");
- /*
- * System.out.println("PlotCanvas.mouseClicked"); System.out.println("
- * mouseClick = [" + mouseClick[0] + " " + mouseClick[1] + "]");
- * System.out.println(" mouseCurent = [" + mouseCurent[0] + " " +
- * mouseCurent[1] + "]");
- */
- /*mouseCurent[0] = e.getX();
- mouseCurent[1] = e.getY();
- e.consume();
- if (allowNote) {
- for (int i = 0; i < plots.size(); i++) {
- double[] _coordNoted = getPlot(i).isSelected(mouseCurent, draw);
- if (_coordNoted != null) {
- getPlot(i).noted = !getPlot(i).noted;
- } else {
- getPlot(i).noted = false;
- }
- }
- repaint();
- }*/
- }
-
- public void mouseWheelMoved(MouseWheelEvent e) {
- //System.out.println("PlotCanvas.mouseWheelMoved");
- /*
- * System.out.println("PlotCanvas.mouseWheelMoved");
- * System.out.println(" mouseClick = [" + mouseClick[0] + " " +
- * mouseClick[1] + "]"); System.out.println(" mouseCurent = [" +
- * mouseCurent[0] + " " + mouseCurent[1] + "]");
- */
- mouseCurent[0] = e.getX();
- mouseCurent[1] = e.getY();
- e.consume();
- int[] origin;
- double[] ratio;
- // double factor = 1.5;
- //switch (ActionMode) {
- // case ZOOM:
- if (e.getWheelRotation() == -1) {
- if (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) > .01) {
- /* (2*factor) */
- /* (2*factor) */
- origin = new int[]{mouseCurent[0] - getWidth() / 3,
- mouseCurent[1] - getHeight() / 3};
- ratio = new double[]{0.666/* 1/factor, 1/factor */, 0.666};
- draw.dilate(origin, ratio);
- }
- } else {
- if (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) < 1) {
- origin = new int[]{(int) (mouseCurent[0] - getWidth() / 1.333/* (2/factor) */),
- (int) (mouseCurent[1] - getHeight() / 1.333/* (2/factor) */)
- };
- ratio = new double[]{1.5, 1.5 /* factor, factor */};
- draw.dilate(origin, ratio);
- } else /* (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) >= 1)*/ {
- ((AWTDrawer) draw).projection.initBaseCoordsProjection(true);
- }
- }
- repaint();
- // break;
- //}
- }
-
- public void componentHidden(ComponentEvent e) {
- }
-
- public void componentMoved(ComponentEvent e) {
- }
-
- public void componentResized(ComponentEvent e) {
- //System.out.println("PlotCanvas.componentResized");
- //panelSize = new int[] { (int) (getSize().getWidth()), (int) (getSize().getHeight()) };
- if (draw != null) {
- draw.resetBaseProjection();
- }
- //System.out.println("PlotCanvas : "+panelSize[0]+" x "+panelSize[1]);
- repaint();
- if (linkedLegendPanel != null) {
- linkedLegendPanel.componentResized(e);
- }
- }
-
- public void componentShown(ComponentEvent e) {
- }
-}
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DataFrame.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DataFrame.java
deleted file mode 100644
index 18149b3..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DataFrame.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.xbib.graphics.graph.jmathplot.frame;
-
-import org.xbib.graphics.graph.jmathplot.canvas.PlotCanvas;
-import org.xbib.graphics.graph.jmathplot.Plot;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-public class DataFrame extends JFrame {
-
- private static final long serialVersionUID = 1L;
- private final PlotCanvas plotCanvas;
- private final JTabbedPane panels;
-
- public DataFrame(PlotCanvas p) {
- super("Data");
- plotCanvas = p;
- JPanel panel = new JPanel();
- panels = new JTabbedPane();
-
- panel.add(panels);
- setContentPane(panel);
- //setVisible(true);
- }
-
- @Override
- public void setVisible(boolean b) {
- if (b) {
- setPanel();
- }
- super.setVisible(b);
- }
-
- private void setPanel() {
- panels.removeAll();
- for (Plot plot : plotCanvas.getPlots()) {
- panels.add(plot.getDataPanel(plotCanvas), plot.getName());
- }
- pack();
- }
-
- public void selectIndex(int i) {
- setVisible(true);
- if (panels.getTabCount() > i) {
- panels.setSelectedIndex(i);
- }
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DataToolBar.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DataToolBar.java
deleted file mode 100644
index 79f8239..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DataToolBar.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.xbib.graphics.graph.jmathplot.frame;
-
-import org.xbib.graphics.graph.jmathplot.panel.DataPanel;
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.security.AccessControlException;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JToolBar;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-
-public class DataToolBar extends JToolBar {
-
- /**
- * Comment for serialVersionUID
- */
- private static final long serialVersionUID = 1L;
-
- protected JButton buttonPasteToClipboard;
-
- protected JButton buttonSaveFile;
-
- private boolean denySaveSecurity;
-
- private JFileChooser fileChooser;
-
- private final DataPanel dataPanel;
-
- public DataToolBar(DataPanel dp) {
-
- dataPanel = dp;
-
- try {
- fileChooser = new JFileChooser();
- } catch (AccessControlException ace) {
- denySaveSecurity = true;
- }
-
- buttonPasteToClipboard = new JButton(new ImageIcon(PlotPanel.class.getResource("icons/toclipboard.png")));
- buttonPasteToClipboard.setToolTipText("Copy data to clipboard");
-
- buttonSaveFile = new JButton(new ImageIcon(PlotPanel.class.getResource("icons/tofile.png")));
- buttonSaveFile.setToolTipText("Save data into ASCII file");
-
- buttonPasteToClipboard.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- dataPanel.toClipBoard();
- }
- });
- buttonSaveFile.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- chooseFile();
- }
- });
-
- add(buttonPasteToClipboard, null);
- add(buttonSaveFile, null);
-
- if (!denySaveSecurity) {
- fileChooser.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- saveFile();
- }
- });
- } else {
- buttonSaveFile.setEnabled(false);
- }
- }
-
- void saveFile() {
- java.io.File file = fileChooser.getSelectedFile();
- dataPanel.toASCIIFile(file);
- }
-
- void chooseFile() {
- fileChooser.showSaveDialog(this);
- }
-
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DatasFrame.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DatasFrame.java
deleted file mode 100644
index 2823166..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/DatasFrame.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.xbib.graphics.graph.jmathplot.frame;
-
-import org.xbib.graphics.graph.jmathplot.panel.MatrixTablePanel;
-import org.xbib.graphics.graph.jmathplot.canvas.PlotCanvas;
-import org.xbib.graphics.graph.jmathplot.Plot;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JColorChooser;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-
-public class DatasFrame extends JFrame {
-
- private static final long serialVersionUID = 1L;
-
- private final PlotCanvas plotCanvas;
-
- private final LegendPanel legend;
-
- public JTabbedPane panels;
-
- public DatasFrame(PlotCanvas p, LegendPanel l) {
- super("Data");
- plotCanvas = p;
- legend = l;
- JPanel panel = new JPanel();
- panels = new JTabbedPane();
-
- for (Plot plot : plotCanvas.getPlots()) {
- panels.add(new DataPanel(/*this, */plot), plot.getName());
- }
-
-
- panel.add(panels);
- setContentPane(panel);
- pack();
- setVisible(true);
- }
-
- public class DataPanel extends JPanel {
-
- private static final long serialVersionUID = 1L;
-
- MatrixTablePanel XY;
-
- JCheckBox visible;
-
- JButton color;
-
- JPanel plottoolspanel;
-
- Plot plot;
-
- DatasFrame dframe;
-
- public DataPanel(/*DatasFrame _dframe,*/Plot _plot) {
- plot = _plot;
- //dframe = _dframe;
- visible = new JCheckBox("visible");
- visible.setSelected(plot.getVisible());
- color = new JButton();
- color.setBackground(plot.getColor());
- XY = new MatrixTablePanel(plotCanvas.reverseMapedData(plot.getData()));
-
- visible.addChangeListener(new ChangeListener() {
- public void stateChanged(ChangeEvent e) {
- plot.setVisible(visible.isSelected());
- /*dframe.*/
- plotCanvas.repaint();
- }
- });
- color.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Color c = JColorChooser.showDialog(plotCanvas, "Choose plot color", plot.getColor());
- color.setBackground(c);
- plot.setColor(c);
- legend.updateLegends();
- /*dframe.*/
- plotCanvas.linkedLegendPanel.repaint();
- /*dframe.*/
- plotCanvas.repaint();
- }
- });
-
- this.setLayout(new BorderLayout());
- plottoolspanel = new JPanel();
- plottoolspanel.add(visible);
- plottoolspanel.add(color);
- this.add(plottoolspanel, BorderLayout.NORTH);
- this.add(XY, BorderLayout.CENTER);
- }
- }
-}
\ No newline at end of file
diff --git a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/LegendPanel.java b/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/LegendPanel.java
deleted file mode 100644
index baa019e..0000000
--- a/graphics-graph-jmathplot/src/main/java/org/xbib/graphics/graph/jmathplot/frame/LegendPanel.java
+++ /dev/null
@@ -1,270 +0,0 @@
-package org.xbib.graphics.graph.jmathplot.frame;
-
-import org.xbib.graphics.graph.jmathplot.panel.PlotPanel;
-import org.xbib.graphics.graph.jmathplot.canvas.PlotCanvas;
-import org.xbib.graphics.graph.jmathplot.Plot;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.LinkedList;
-import javax.swing.BorderFactory;
-import javax.swing.JColorChooser;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.border.Border;
-
-/**
- * BSD License
- *
- * @author Yann RICHET
- */
-public class LegendPanel extends JPanel implements ComponentListener {
-
- private static final long serialVersionUID = 1L;
- PlotCanvas plotCanvas;
- PlotPanel plotPanel;
- LinkedList