This commit is contained in:
parent
df9c625771
commit
e49b0e1a16
@ -29,8 +29,6 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
@ -49,7 +47,6 @@ import eva2.tools.chart2d.DPointIcon;
|
|||||||
import eva2.tools.chart2d.DPointSet;
|
import eva2.tools.chart2d.DPointSet;
|
||||||
import eva2.tools.chart2d.ScaledBorder;
|
import eva2.tools.chart2d.ScaledBorder;
|
||||||
|
|
||||||
|
|
||||||
/*==========================================================================*
|
/*==========================================================================*
|
||||||
* CLASS DECLARATION
|
* CLASS DECLARATION
|
||||||
*==========================================================================*/
|
*==========================================================================*/
|
||||||
@ -57,6 +54,10 @@ import eva2.tools.chart2d.ScaledBorder;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FunctionArea extends DArea implements Serializable {
|
public class FunctionArea extends DArea implements Serializable {
|
||||||
|
/**
|
||||||
|
* Generated serial version identifier.
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1238444548498667204L;
|
||||||
private InterfaceRefPointListener m_RefPointListener;
|
private InterfaceRefPointListener m_RefPointListener;
|
||||||
private JFileChooser m_FileChooser;
|
private JFileChooser m_FileChooser;
|
||||||
private ArrayList<GraphPointSet> m_PointSetContainer;
|
private ArrayList<GraphPointSet> m_PointSetContainer;
|
||||||
@ -70,10 +71,12 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
private GraphPointSetLegend legendBox = null;
|
private GraphPointSetLegend legendBox = null;
|
||||||
|
|
||||||
private DPointIcon m_CurrentPointIcon;
|
private DPointIcon m_CurrentPointIcon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public FunctionArea() {}
|
public FunctionArea() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -84,46 +87,48 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
setVisibleRectangle(1, 1, 100000, 1000);
|
setVisibleRectangle(1, 1, 100000, 1000);
|
||||||
setAutoFocus(true);
|
setAutoFocus(true);
|
||||||
setMinRectangle(0, 0, 1, 1);
|
setMinRectangle(0, 0, 1, 1);
|
||||||
setBackground(new Color(253,253,253)); // not quite white
|
setBackground(new Color(253, 253, 253)); // not quite white
|
||||||
//setAutoFocus(true);
|
// setAutoFocus(true);
|
||||||
m_Border = new ScaledBorder();
|
m_Border = new ScaledBorder();
|
||||||
m_Border.x_label = xname; //"App. " + Name + " func. calls";
|
m_Border.x_label = xname; // "App. " + Name + " func. calls";
|
||||||
m_Border.y_label = yname; //"fitness";
|
m_Border.y_label = yname; // "fitness";
|
||||||
setBorder(m_Border);
|
setBorder(m_Border);
|
||||||
setAutoGrid(true);
|
setAutoGrid(true);
|
||||||
setGridVisible(true);
|
setGridVisible(true);
|
||||||
m_PointSetContainer = new ArrayList<GraphPointSet>(20);
|
m_PointSetContainer = new ArrayList<GraphPointSet>(20);
|
||||||
//new DMouseZoom( this );
|
// new DMouseZoom( this );
|
||||||
addPopup();
|
addPopup();
|
||||||
repaint();
|
repaint();
|
||||||
notifyNegLog = true;
|
notifyNegLog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a legend for the function area. If null is given, the former legend is deactivated.
|
* Set a legend for the function area. If null is given, the former legend
|
||||||
|
* is deactivated.
|
||||||
*
|
*
|
||||||
* @param lBox
|
* @param lBox
|
||||||
*/
|
*/
|
||||||
protected void setLegend(GraphPointSetLegend lBox) {
|
protected void setLegend(GraphPointSetLegend lBox) {
|
||||||
legendBox=lBox;
|
legendBox = lBox;
|
||||||
if (lBox!=null && m_legend) repaint();
|
if (lBox != null && m_legend)
|
||||||
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot a circle icon to the function area which is annotated with a char and
|
* Plot a circle icon to the function area which is annotated with a char
|
||||||
* a double value.
|
* and a double value.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c
|
||||||
* @param val
|
* @param val
|
||||||
* @param position
|
* @param position
|
||||||
*/
|
*/
|
||||||
public void drawCircle(double val, double[] position, int graphID) {
|
public void drawCircle(double val, double[] position, int graphID) {
|
||||||
drawCircle(""+val, position, graphID);
|
drawCircle("" + val, position, graphID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot a circle icon to the function area which is annotated with a char and
|
* Plot a circle icon to the function area which is annotated with a char
|
||||||
* a double value.
|
* and a double value.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c
|
||||||
* @param val
|
* @param val
|
||||||
@ -131,19 +136,20 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* @param graphID
|
* @param graphID
|
||||||
*/
|
*/
|
||||||
public void drawCircle(char c, double val, double[] position, int graphID) {
|
public void drawCircle(char c, double val, double[] position, int graphID) {
|
||||||
drawCircle(c+""+val, position, graphID);
|
drawCircle(c + "" + val, position, graphID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawCircle(String label, double xPos, double yPos, int graphID) {
|
public void drawCircle(String label, double xPos, double yPos, int graphID) {
|
||||||
double[] pos = new double[2];
|
double[] pos = new double[2];
|
||||||
pos[0]=xPos;
|
pos[0] = xPos;
|
||||||
pos[1]=yPos;
|
pos[1] = yPos;
|
||||||
drawCircle(label, pos, graphID);
|
drawCircle(label, pos, graphID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot a circle icon to the function area which is annotated with a char and
|
* Plot a circle icon to the function area which is annotated with a char
|
||||||
* a double value. The color corresponds to the color of the graph with given ID
|
* and a double value. The color corresponds to the color of the graph with
|
||||||
|
* given ID
|
||||||
*
|
*
|
||||||
* @param label
|
* @param label
|
||||||
* @param position
|
* @param position
|
||||||
@ -154,21 +160,28 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot an icon to the function area which is annotated with a char and
|
* Plot an icon to the function area which is annotated with a char and a
|
||||||
* a double value. The color corresponds to the color of the graph with given ID
|
* double value. The color corresponds to the color of the graph with given
|
||||||
* Icon types are 0: circle, 1: cross, otherwise: point.
|
* ID Icon types are 0: circle, 1: cross, otherwise: point.
|
||||||
*
|
*
|
||||||
* @param label
|
* @param label
|
||||||
* @param position
|
* @param position
|
||||||
* @param graphID
|
* @param graphID
|
||||||
*/
|
*/
|
||||||
public void drawIcon(int iconType, String label, double[] position, int graphID) {
|
public void drawIcon(int iconType, String label, double[] position,
|
||||||
|
int graphID) {
|
||||||
DPointIcon theIcon;
|
DPointIcon theIcon;
|
||||||
switch (iconType) {
|
switch (iconType) {
|
||||||
case 0: theIcon = new Chart2DDPointIconCircle(); break;
|
case 0:
|
||||||
case 1: theIcon = new Chart2DDPointIconCross(); break;
|
theIcon = new Chart2DDPointIconCircle();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
theIcon = new Chart2DDPointIconCross();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
case 2: theIcon = new Chart2DDPointIconPoint(); break;
|
case 2:
|
||||||
|
theIcon = new Chart2DDPointIconPoint();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
drawIcon(theIcon, label, position, graphID);
|
drawIcon(theIcon, label, position, graphID);
|
||||||
}
|
}
|
||||||
@ -188,20 +201,23 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot a circle icon to the function area which is annotated with a char and
|
* Plot a circle icon to the function area which is annotated with a char
|
||||||
* a double value. The color corresponds to the color of the graph with given ID
|
* and a double value. The color corresponds to the color of the graph with
|
||||||
|
* given ID
|
||||||
*
|
*
|
||||||
* @param label
|
* @param label
|
||||||
* @param position
|
* @param position
|
||||||
* @param graphID
|
* @param graphID
|
||||||
*/
|
*/
|
||||||
public void drawIcon(DPointIcon theIcon, String label, double[] position, int graphID) {
|
public void drawIcon(DPointIcon theIcon, String label, double[] position,
|
||||||
|
int graphID) {
|
||||||
DPointSet popRep;
|
DPointSet popRep;
|
||||||
popRep = new DPointSet();
|
popRep = new DPointSet();
|
||||||
popRep.addDPoint(new DPoint(position[0], position[1]));
|
popRep.addDPoint(new DPoint(position[0], position[1]));
|
||||||
DPointIcon icon = new Chart2DDPointIconText(label);
|
DPointIcon icon = new Chart2DDPointIconText(label);
|
||||||
((Chart2DDPointIconText)icon).setIcon(theIcon);
|
((Chart2DDPointIconText) icon).setIcon(theIcon);
|
||||||
((Chart2DDPointIconText)icon).setColor(getGraphPointSet(graphID).getColor());
|
((Chart2DDPointIconText) icon).setColor(getGraphPointSet(graphID)
|
||||||
|
.getColor());
|
||||||
popRep.setIcon(icon);
|
popRep.setIcon(icon);
|
||||||
addDElement(popRep);
|
addDElement(popRep);
|
||||||
}
|
}
|
||||||
@ -214,8 +230,11 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0))
|
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0))
|
||||||
return ret;
|
return ret;
|
||||||
int minindex = getNearestGraphIndex(x, y);
|
int minindex = getNearestGraphIndex(x, y);
|
||||||
if (minindex>=0) return ((GraphPointSet) (m_PointSetContainer.get(minindex))).getInfoString();
|
if (minindex >= 0)
|
||||||
else return "none";
|
return ((GraphPointSet) (m_PointSetContainer.get(minindex)))
|
||||||
|
.getInfoString();
|
||||||
|
else
|
||||||
|
return "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,7 +245,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0))
|
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0))
|
||||||
return ret;
|
return ret;
|
||||||
int minindex = getNearestGraphIndex(x, y);
|
int minindex = getNearestGraphIndex(x, y);
|
||||||
ret = ((GraphPointSet) (m_PointSetContainer.get(minindex))).isStatisticsGraph();
|
ret = ((GraphPointSet) (m_PointSetContainer.get(minindex)))
|
||||||
|
.isStatisticsGraph();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,8 +268,9 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
if (point1 == null)
|
if (point1 == null)
|
||||||
System.err.println("point1 == null");
|
System.err.println("point1 == null");
|
||||||
|
|
||||||
dist = (point1.x - point2.x) * (point1.x - point2.x) + (point1.y - point2.y) * (point1.y - point2.y);
|
dist = (point1.x - point2.x) * (point1.x - point2.x)
|
||||||
//System.out.println("dist="+dist+"i="+i);
|
+ (point1.y - point2.y) * (point1.y - point2.y);
|
||||||
|
// System.out.println("dist="+dist+"i="+i);
|
||||||
if (dist < distmin) {
|
if (dist < distmin) {
|
||||||
distmin = dist;
|
distmin = dist;
|
||||||
minindex = i;
|
minindex = i;
|
||||||
@ -269,18 +290,22 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
DPoint point2 = null;
|
DPoint point2 = null;
|
||||||
double dist = 0;
|
double dist = 0;
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
||||||
if (m_PointSetContainer.get(i)instanceof GraphPointSet) {
|
if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
|
||||||
GraphPointSet pointset = (GraphPointSet) (m_PointSetContainer.get(i));
|
GraphPointSet pointset = (GraphPointSet) (m_PointSetContainer
|
||||||
|
.get(i));
|
||||||
point2 = pointset.getNearestDPoint(point1);
|
point2 = pointset.getNearestDPoint(point1);
|
||||||
if (point2 == null)
|
if (point2 == null)
|
||||||
continue;
|
continue;
|
||||||
dist = (point1.x - point2.x) * (point1.x - point2.x) + (point1.y - point2.y) * (point1.y - point2.y);
|
dist = (point1.x - point2.x) * (point1.x - point2.x)
|
||||||
//System.out.println("dist="+dist+"i="+i);
|
+ (point1.y - point2.y) * (point1.y - point2.y);
|
||||||
|
// System.out.println("dist="+dist+"i="+i);
|
||||||
if (dist < distmin) {
|
if (dist < distmin) {
|
||||||
distmin = dist;
|
distmin = dist;
|
||||||
ret = point2;
|
ret = point2;
|
||||||
}
|
}
|
||||||
if ((dist == distmin) && !(ret.getIcon()instanceof Chart2DDPointIconContent) && !(ret.getIcon()instanceof InterfaceSelectablePointIcon)) {
|
if ((dist == distmin)
|
||||||
|
&& !(ret.getIcon() instanceof Chart2DDPointIconContent)
|
||||||
|
&& !(ret.getIcon() instanceof InterfaceSelectablePointIcon)) {
|
||||||
distmin = dist;
|
distmin = dist;
|
||||||
ret = point2;
|
ret = point2;
|
||||||
}
|
}
|
||||||
@ -294,7 +319,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void exportToAscii() {
|
public void exportToAscii() {
|
||||||
exportToAscii((File)null);
|
exportToAscii((File) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String cleanBlanks(String str, Character rpl) {
|
private String cleanBlanks(String str, Character rpl) {
|
||||||
@ -302,10 +327,11 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export contained data to a file or to standard out if null is given.
|
* Export contained data to a file or to standard out if null is given. The
|
||||||
* The given File will be overwritten!
|
* given File will be overwritten!
|
||||||
*
|
*
|
||||||
* @param file a File instance or null to export to standard out
|
* @param file
|
||||||
|
* a File instance or null to export to standard out
|
||||||
* @return true if the export succeeded, else false
|
* @return true if the export succeeded, else false
|
||||||
*/
|
*/
|
||||||
public boolean exportToAscii(File file) {
|
public boolean exportToAscii(File file) {
|
||||||
@ -319,10 +345,12 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
maxSize = maxSet.getSize();
|
maxSize = maxSet.getSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxSize > 0) { // if there is any data, init string array and set x value column
|
if (maxSize > 0) { // if there is any data, init string array and set x
|
||||||
|
// value column
|
||||||
s = new String[maxSize + 1];
|
s = new String[maxSize + 1];
|
||||||
s[0] = "calls";
|
s[0] = "calls";
|
||||||
for (int j = 1; j <= maxSize; j++) s[j] = "" + maxSet.getDPoint(j-1).x;
|
for (int j = 1; j <= maxSize; j++)
|
||||||
|
s[j] = "" + maxSet.getDPoint(j - 1).x;
|
||||||
} else {
|
} else {
|
||||||
System.err.println("Error: no data to export");
|
System.err.println("Error: no data to export");
|
||||||
return true;
|
return true;
|
||||||
@ -331,21 +359,30 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
|
if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
|
||||||
GraphPointSet set = (GraphPointSet) m_PointSetContainer.get(i);
|
GraphPointSet set = (GraphPointSet) m_PointSetContainer.get(i);
|
||||||
DPointSet pset = set.getConnectedPointSet();
|
DPointSet pset = set.getConnectedPointSet();
|
||||||
s[0] = s[0] + " " + cleanBlanks(set.getInfoString(), '_'); // add column name
|
s[0] = s[0] + " " + cleanBlanks(set.getInfoString(), '_'); // add
|
||||||
for (int j = 1; j < s.length; j++) { // add column data of place holder if no value in this set
|
// column
|
||||||
if ((j-1) < pset.getSize()) s[j] = s[j] + " " + pset.getDPoint(j - 1).y;
|
// name
|
||||||
else s[j] += " #";
|
for (int j = 1; j < s.length; j++) { // add column data of place
|
||||||
|
// holder if no value in
|
||||||
|
// this set
|
||||||
|
if ((j - 1) < pset.getSize())
|
||||||
|
s[j] = s[j] + " " + pset.getDPoint(j - 1).y;
|
||||||
|
else
|
||||||
|
s[j] += " #";
|
||||||
}
|
}
|
||||||
} else System.err.println("error in FunctionArea::exportToAscii");
|
} else
|
||||||
|
System.err.println("error in FunctionArea::exportToAscii");
|
||||||
}
|
}
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
for (int j = 0; j < s.length; j++) {
|
for (int j = 0; j < s.length; j++) {
|
||||||
System.out.println(s[j]);
|
System.out.println(s[j]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else try {
|
} else
|
||||||
|
try {
|
||||||
PrintWriter out = new PrintWriter(new FileOutputStream(file));
|
PrintWriter out = new PrintWriter(new FileOutputStream(file));
|
||||||
for (int j = 0; j < s.length; j++) out.println(s[j]);
|
for (int j = 0; j < s.length; j++)
|
||||||
|
out.println(s[j]);
|
||||||
out.flush();
|
out.flush();
|
||||||
out.close();
|
out.close();
|
||||||
return true;
|
return true;
|
||||||
@ -358,12 +395,15 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Export contained data to a file with a given String as prefix
|
* Export contained data to a file with a given String as prefix
|
||||||
*
|
*
|
||||||
* @param prefix file name prefix
|
* @param prefix
|
||||||
|
* file name prefix
|
||||||
* @return true if the export succeeded, else false
|
* @return true if the export succeeded, else false
|
||||||
*/
|
*/
|
||||||
public boolean exportToAscii(String prefix) {
|
public boolean exportToAscii(String prefix) {
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("E'_'yyyy.MM.dd'_'HH.mm.ss");
|
SimpleDateFormat formatter = new SimpleDateFormat(
|
||||||
String fname = prefix+"PlotExport_"+formatter.format(new Date())+".txt";
|
"E'_'yyyy.MM.dd'_'HH.mm.ss");
|
||||||
|
String fname = prefix + "PlotExport_" + formatter.format(new Date())
|
||||||
|
+ ".txt";
|
||||||
try {
|
try {
|
||||||
File f = new File(fname);
|
File f = new File(fname);
|
||||||
f.createNewFile();
|
f.createNewFile();
|
||||||
@ -378,7 +418,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
super.paint(g);
|
super.paint(g);
|
||||||
if (legendBox!=null && (m_legend)) legendBox.paintIn(g, m_Border.getInnerRect(this));
|
if (legendBox != null && (m_legend))
|
||||||
|
legendBox.paintIn(g, m_Border.getInnerRect(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -393,42 +434,45 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public void setConnectedPoint(double x, double y, int graphLabel) {
|
public void setConnectedPoint(double x, double y, int graphLabel) {
|
||||||
if (!checkLogValidYValue(x, y, graphLabel)) {
|
if (!checkLogValidYValue(x, y, graphLabel)) {
|
||||||
if (m_log) toggleLog();
|
if (m_log)
|
||||||
|
toggleLog();
|
||||||
}
|
}
|
||||||
// if (y <= 0.0) {
|
// if (y <= 0.0) {
|
||||||
//// y = Double.MIN_VALUE;
|
// // y = Double.MIN_VALUE;
|
||||||
// if (notifyNegLog) {
|
// if (notifyNegLog) {
|
||||||
// System.err.println("Warning: trying to plot value (" + x + "/" + y + ") with y <= 0 in logarithmic mode! Setting y to " + 1e-30);
|
// System.err.println("Warning: trying to plot value (" + x + "/" + y +
|
||||||
// notifyNegLog = false;
|
// ") with y <= 0 in logarithmic mode! Setting y to " + 1e-30);
|
||||||
// }
|
// notifyNegLog = false;
|
||||||
// y = 1e-30;
|
// }
|
||||||
// }
|
// y = 1e-30;
|
||||||
|
// }
|
||||||
getGraphPointSet(graphLabel).addDPoint(x, y);
|
getGraphPointSet(graphLabel).addDPoint(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setConnectedPoint(double x, double y, int GraphLabel) {
|
// public void setConnectedPoint(double x, double y, int GraphLabel) {
|
||||||
// if (m_log == true && y <= 0.0) {
|
// if (m_log == true && y <= 0.0) {
|
||||||
//// y = Double.MIN_VALUE;
|
// // y = Double.MIN_VALUE;
|
||||||
// if (notifyNegLog) {
|
// if (notifyNegLog) {
|
||||||
// System.err.println("Warning: trying to plot value (" + x + "/" + y + ") with y <= 0 in logarithmic mode! Setting y to " + 1e-30);
|
// System.err.println("Warning: trying to plot value (" + x + "/" + y +
|
||||||
// notifyNegLog = false;
|
// ") with y <= 0 in logarithmic mode! Setting y to " + 1e-30);
|
||||||
// }
|
// notifyNegLog = false;
|
||||||
// y = 1e-30;
|
// }
|
||||||
// }
|
// y = 1e-30;
|
||||||
// getGraphPointSet(GraphLabel).addDPoint(x, y);
|
// }
|
||||||
//
|
// getGraphPointSet(GraphLabel).addDPoint(x, y);
|
||||||
// }
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
public void addGraphPointSet(GraphPointSet d) {
|
public void addGraphPointSet(GraphPointSet d) {
|
||||||
this.m_PointSetContainer.add(d);
|
this.m_PointSetContainer.add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void addGraph(int GraphLabel_1, int GraphLabel_2, boolean forceAdd) {
|
public void addGraph(int GraphLabel_1, int GraphLabel_2, boolean forceAdd) {
|
||||||
getGraphPointSet(GraphLabel_1).addGraph(getGraphPointSet(GraphLabel_2), this.getDMeasures(), forceAdd);
|
getGraphPointSet(GraphLabel_1).addGraph(getGraphPointSet(GraphLabel_2),
|
||||||
|
this.getDMeasures(), forceAdd);
|
||||||
notifyNegLog = true;
|
notifyNegLog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +501,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
int index = getNearestGraphIndex(x, y);
|
int index = getNearestGraphIndex(x, y);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return;
|
return;
|
||||||
int GraphLabel = ((GraphPointSet) (this.m_PointSetContainer.get(index))).getGraphLabel();
|
int GraphLabel = ((GraphPointSet) (this.m_PointSetContainer.get(index)))
|
||||||
|
.getGraphLabel();
|
||||||
clearGraph(GraphLabel);
|
clearGraph(GraphLabel);
|
||||||
updateLegend();
|
updateLegend();
|
||||||
}
|
}
|
||||||
@ -469,7 +514,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
int index = getNearestGraphIndex(x, y);
|
int index = getNearestGraphIndex(x, y);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return;
|
return;
|
||||||
int GraphLabel = ((GraphPointSet) (this.m_PointSetContainer.get(index))).getGraphLabel();
|
int GraphLabel = ((GraphPointSet) (this.m_PointSetContainer.get(index)))
|
||||||
|
.getGraphLabel();
|
||||||
changeColorGraph(GraphLabel);
|
changeColorGraph(GraphLabel);
|
||||||
updateLegend();
|
updateLegend();
|
||||||
}
|
}
|
||||||
@ -482,7 +528,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
int index = getNearestGraphIndex(x, y);
|
int index = getNearestGraphIndex(x, y);
|
||||||
if (index == -1 || point == null)
|
if (index == -1 || point == null)
|
||||||
return;
|
return;
|
||||||
GraphPointSet pointset = (GraphPointSet) (this.m_PointSetContainer.get(index));
|
GraphPointSet pointset = (GraphPointSet) (this.m_PointSetContainer
|
||||||
|
.get(index));
|
||||||
pointset.removePoint(point);
|
pointset.removePoint(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,34 +555,37 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private GraphPointSet getGraphPointSet(int GraphLabel) {
|
private GraphPointSet getGraphPointSet(int GraphLabel) {
|
||||||
// System.out.println("looping through " + m_PointSetContainer.size() + " point sets...");
|
// System.out.println("looping through " + m_PointSetContainer.size() +
|
||||||
|
// " point sets...");
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
||||||
if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
|
if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
|
||||||
GraphPointSet xx = (GraphPointSet) (m_PointSetContainer.get(i));
|
GraphPointSet xx = (GraphPointSet) (m_PointSetContainer.get(i));
|
||||||
// System.out.println("looking at "+xx.getGraphLabel());
|
// System.out.println("looking at "+xx.getGraphLabel());
|
||||||
if (xx.getGraphLabel() == GraphLabel) {
|
if (xx.getGraphLabel() == GraphLabel) {
|
||||||
// System.out.println("match!");
|
// System.out.println("match!");
|
||||||
return xx;
|
return xx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// create new GraphPointSet
|
// create new GraphPointSet
|
||||||
GraphPointSet NewPointSet = new GraphPointSet(GraphLabel, this);
|
GraphPointSet NewPointSet = new GraphPointSet(GraphLabel, this);
|
||||||
// System.out.println("adding new point set " + GraphLabel);
|
// System.out.println("adding new point set " + GraphLabel);
|
||||||
//NewPointSet.setStroke(new BasicStroke( (float)1.0 ));
|
// NewPointSet.setStroke(new BasicStroke( (float)1.0 ));
|
||||||
//addGraphPointSet(NewPointSet); already done within GraphPointSet!!!
|
// addGraphPointSet(NewPointSet); already done within GraphPointSet!!!
|
||||||
return NewPointSet;
|
return NewPointSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnconnectedPoint(double[] p, int GraphLabel) {
|
public void setUnconnectedPoint(double[] p, int GraphLabel) {
|
||||||
setUnconnectedPoint(p[0], p[1], GraphLabel);
|
setUnconnectedPoint(p[0], p[1], GraphLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setUnconnectedPoint(double x, double y, int GraphLabel) {
|
public void setUnconnectedPoint(double x, double y, int GraphLabel) {
|
||||||
if (!checkLogValidYValue(x, y, GraphLabel)) {
|
if (!checkLogValidYValue(x, y, GraphLabel)) {
|
||||||
if (m_log) toggleLog();
|
if (m_log)
|
||||||
|
toggleLog();
|
||||||
}
|
}
|
||||||
this.getGraphPointSet(GraphLabel).addDPoint(x, y);
|
this.getGraphPointSet(GraphLabel).addDPoint(x, y);
|
||||||
this.getGraphPointSet(GraphLabel).setConnectedMode(false);
|
this.getGraphPointSet(GraphLabel).setConnectedMode(false);
|
||||||
@ -546,16 +596,18 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
double minY = Double.MAX_VALUE;
|
double minY = Double.MAX_VALUE;
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
||||||
DPointSet pSet = (m_PointSetContainer.get(i).getConnectedPointSet());
|
DPointSet pSet = (m_PointSetContainer.get(i).getConnectedPointSet());
|
||||||
if (pSet.getSize() > 0) minY = Math.min(minY, pSet.getMinYVal());
|
if (pSet.getSize() > 0)
|
||||||
|
minY = Math.min(minY, pSet.getMinYVal());
|
||||||
}
|
}
|
||||||
// if (TRACE) System.out.println("min is " + minY);
|
// if (TRACE) System.out.println("min is " + minY);
|
||||||
return (minY > 0);
|
return (minY > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkLogValidYValue(double x, double y, int graphLabel) {
|
protected boolean checkLogValidYValue(double x, double y, int graphLabel) {
|
||||||
if (y <= 0.0) {
|
if (y <= 0.0) {
|
||||||
if (m_log && notifyNegLog) {
|
if (m_log && notifyNegLog) {
|
||||||
System.err.println("Warning: trying to plot value (" + x + "/" + y + ") with y <= 0 in logarithmic mode!" );
|
System.err.println("Warning: trying to plot value (" + x + "/"
|
||||||
|
+ y + ") with y <= 0 in logarithmic mode!");
|
||||||
notifyNegLog = false;
|
notifyNegLog = false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -563,7 +615,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGraphColor(int GraphLabel,int colorindex) {
|
public void setGraphColor(int GraphLabel, int colorindex) {
|
||||||
this.getGraphPointSet(GraphLabel).setColorByIndex(colorindex);
|
this.getGraphPointSet(GraphLabel).setColorByIndex(colorindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,26 +652,26 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DPointSet printPoints(int i) {
|
public DPointSet printPoints(int i) {
|
||||||
//for (int i = 0; i < m_PointSetContainer.size();i++) {
|
// for (int i = 0; i < m_PointSetContainer.size();i++) {
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("GraphPointSet No " + i);
|
System.out.println("GraphPointSet No " + i);
|
||||||
|
|
||||||
return ((GraphPointSet) m_PointSetContainer.get(i)).printPoints();
|
return ((GraphPointSet) m_PointSetContainer.get(i)).printPoints();
|
||||||
//}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void toggleLog() {
|
public void toggleLog() {
|
||||||
//System.out.println("ToggleLog log was: "+m_log);
|
// System.out.println("ToggleLog log was: "+m_log);
|
||||||
if (!m_log && !checkLoggable()) {
|
if (!m_log && !checkLoggable()) {
|
||||||
System.err.println("Cant toggle log with values <= 0!");
|
System.err.println("Cant toggle log with values <= 0!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_log == false) {
|
if (m_log == false) {
|
||||||
setMinRectangle(0.001, 0.001, 1, 1);
|
setMinRectangle(0.001, 0.001, 1, 1);
|
||||||
//setVisibleRectangle( 0.001, 0.001, 100000, 1000 );
|
// setVisibleRectangle( 0.001, 0.001, 100000, 1000 );
|
||||||
setYScale(new Exp());
|
setYScale(new Exp());
|
||||||
m_Border.setSrcdY(Math.log(10));
|
m_Border.setSrcdY(Math.log(10));
|
||||||
m_Border.applyPattern(false, "0.###E0");
|
m_Border.applyPattern(false, "0.###E0");
|
||||||
@ -629,82 +681,87 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
setYScale(null);
|
setYScale(null);
|
||||||
ScaledBorder buffer = m_Border;
|
ScaledBorder buffer = m_Border;
|
||||||
m_Border = new ScaledBorder();
|
m_Border = new ScaledBorder();
|
||||||
m_Border.x_label = buffer.x_label; //"App. " + Name + " func. calls";
|
m_Border.x_label = buffer.x_label; // "App. " + Name +
|
||||||
m_Border.y_label = buffer.y_label; //"fitness";
|
// " func. calls";
|
||||||
|
m_Border.y_label = buffer.y_label; // "fitness";
|
||||||
setBorder(m_Border);
|
setBorder(m_Border);
|
||||||
}
|
}
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes all PointSets to interupt the connected painting at the
|
* Causes all PointSets to interupt the connected painting at the current
|
||||||
* current position.
|
* position.
|
||||||
*/
|
*/
|
||||||
public void jump() {
|
public void jump() {
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++)
|
for (int i = 0; i < m_PointSetContainer.size(); i++)
|
||||||
((GraphPointSet) (m_PointSetContainer.get(i))).jump();
|
((GraphPointSet) (m_PointSetContainer.get(i))).jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// */
|
// */
|
||||||
// public Object openObject() {
|
// public Object openObject() {
|
||||||
// if (m_FileChooser == null)
|
// if (m_FileChooser == null)
|
||||||
// createFileChooser();
|
// createFileChooser();
|
||||||
// int returnVal = m_FileChooser.showOpenDialog(this);
|
// int returnVal = m_FileChooser.showOpenDialog(this);
|
||||||
// if (returnVal == JFileChooser.APPROVE_OPTION) {
|
// if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
// File selected = m_FileChooser.getSelectedFile();
|
// File selected = m_FileChooser.getSelectedFile();
|
||||||
// try {
|
// try {
|
||||||
// ObjectInputStream oi = new ObjectInputStream(new BufferedInputStream(new FileInputStream(selected)));
|
// ObjectInputStream oi = new ObjectInputStream(new BufferedInputStream(new
|
||||||
// Object obj = oi.readObject();
|
// FileInputStream(selected)));
|
||||||
// oi.close();
|
// Object obj = oi.readObject();
|
||||||
//
|
// oi.close();
|
||||||
// Object[] objects = (Object[]) obj;
|
//
|
||||||
// for (int i = 0; i < objects.length; i++) {
|
// Object[] objects = (Object[]) obj;
|
||||||
// GraphPointSet xx = ((GraphPointSet.SerPointSet) objects[i]).getGraphPointSet();
|
// for (int i = 0; i < objects.length; i++) {
|
||||||
// xx.initGraph(this);
|
// GraphPointSet xx = ((GraphPointSet.SerPointSet)
|
||||||
// addGraphPointSet(xx);
|
// objects[i]).getGraphPointSet();
|
||||||
// }
|
// xx.initGraph(this);
|
||||||
// repaint();
|
// addGraphPointSet(xx);
|
||||||
// return obj;
|
// }
|
||||||
// } catch (Exception ex) {
|
// repaint();
|
||||||
// JOptionPane.showMessageDialog(this,
|
// return obj;
|
||||||
// "Couldn't read object: "
|
// } catch (Exception ex) {
|
||||||
// + selected.getName()
|
// JOptionPane.showMessageDialog(this,
|
||||||
// + "\n" + ex.getMessage(),
|
// "Couldn't read object: "
|
||||||
// "Open object file",
|
// + selected.getName()
|
||||||
// JOptionPane.ERROR_MESSAGE);
|
// + "\n" + ex.getMessage(),
|
||||||
// }
|
// "Open object file",
|
||||||
// }
|
// JOptionPane.ERROR_MESSAGE);
|
||||||
// return null;
|
// }
|
||||||
// }
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// *
|
// *
|
||||||
// */
|
// */
|
||||||
// public void saveObject() {
|
// public void saveObject() {
|
||||||
// Object[] object = new Object[m_PointSetContainer.size()];
|
// Object[] object = new Object[m_PointSetContainer.size()];
|
||||||
// for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
// for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
||||||
// object[i] = ((GraphPointSet) m_PointSetContainer.get(i)).getSerPointSet();
|
// object[i] = ((GraphPointSet)
|
||||||
// }
|
// m_PointSetContainer.get(i)).getSerPointSet();
|
||||||
// if (m_FileChooser == null)
|
// }
|
||||||
// createFileChooser();
|
// if (m_FileChooser == null)
|
||||||
// int returnVal = m_FileChooser.showSaveDialog(this);
|
// createFileChooser();
|
||||||
// if (returnVal == JFileChooser.APPROVE_OPTION) {
|
// int returnVal = m_FileChooser.showSaveDialog(this);
|
||||||
// File sFile = m_FileChooser.getSelectedFile();
|
// if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
// try {
|
// File sFile = m_FileChooser.getSelectedFile();
|
||||||
// ObjectOutputStream oo = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(sFile)));
|
// try {
|
||||||
// oo.writeObject(object);
|
// ObjectOutputStream oo = new ObjectOutputStream(new
|
||||||
// oo.close();
|
// BufferedOutputStream(new FileOutputStream(sFile)));
|
||||||
// } catch (IOException ex) {
|
// oo.writeObject(object);
|
||||||
// JOptionPane.showMessageDialog(this,
|
// oo.close();
|
||||||
// "Couldn't write to file: "
|
// } catch (IOException ex) {
|
||||||
// + sFile.getName()
|
// JOptionPane.showMessageDialog(this,
|
||||||
// + "\n" + ex.getMessage(),
|
// "Couldn't write to file: "
|
||||||
// "Save object",
|
// + sFile.getName()
|
||||||
// JOptionPane.ERROR_MESSAGE);
|
// + "\n" + ex.getMessage(),
|
||||||
// }
|
// "Save object",
|
||||||
// }
|
// JOptionPane.ERROR_MESSAGE);
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -714,7 +771,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
m_FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
m_FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a popup menu for displaying certain information.
|
/**
|
||||||
|
* Add a popup menu for displaying certain information.
|
||||||
*/
|
*/
|
||||||
private void addPopup() {
|
private void addPopup() {
|
||||||
addMouseListener(new MouseAdapter() {
|
addMouseListener(new MouseAdapter() {
|
||||||
@ -727,14 +785,17 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
m_y = e.getY();
|
m_y = e.getY();
|
||||||
|
|
||||||
// The first info element
|
// The first info element
|
||||||
JMenuItem Info = new JMenuItem("Graph Info: " + getGraphInfo(e.getX(), e.getY()));
|
JMenuItem Info = new JMenuItem("Graph Info: "
|
||||||
|
+ getGraphInfo(e.getX(), e.getY()));
|
||||||
Info.addActionListener(new ActionListener() {
|
Info.addActionListener(new ActionListener() {
|
||||||
//
|
//
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
DPoint temp = FunctionArea.this.getDMeasures().getDPoint(FunctionArea.this.m_x, FunctionArea.this.m_y);
|
DPoint temp = FunctionArea.this.getDMeasures()
|
||||||
|
.getDPoint(FunctionArea.this.m_x,
|
||||||
|
FunctionArea.this.m_y);
|
||||||
DPointIcon icon1 = new DPointIcon() {
|
DPointIcon icon1 = new DPointIcon() {
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
g.drawLine( -2, 0, 2, 0);
|
g.drawLine(-2, 0, 2, 0);
|
||||||
g.drawLine(0, 0, 0, 4);
|
g.drawLine(0, 0, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,10 +810,12 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
GraphMenu.add(Info);
|
GraphMenu.add(Info);
|
||||||
if (m_RefPointListener != null) {
|
if (m_RefPointListener != null) {
|
||||||
DPoint temp = getDMeasures().getDPoint(m_x, m_y);
|
DPoint temp = getDMeasures().getDPoint(m_x, m_y);
|
||||||
JMenuItem refPoint = new JMenuItem("Reference Point:("+temp.x+"/"+temp.y+")");
|
JMenuItem refPoint = new JMenuItem("Reference Point:("
|
||||||
|
+ temp.x + "/" + temp.y + ")");
|
||||||
refPoint.addActionListener(new ActionListener() {
|
refPoint.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
DPoint temp = getDMeasures().getDPoint(m_x, m_y);
|
DPoint temp = getDMeasures()
|
||||||
|
.getDPoint(m_x, m_y);
|
||||||
double[] point = new double[2];
|
double[] point = new double[2];
|
||||||
point[0] = temp.x;
|
point[0] = temp.x;
|
||||||
point[1] = temp.y;
|
point[1] = temp.y;
|
||||||
@ -766,35 +829,47 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
DPoint point = getNearestDPoint(e.getX(), e.getY());
|
DPoint point = getNearestDPoint(e.getX(), e.getY());
|
||||||
|
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
JMenuItem InfoXY = new JMenuItem("(" + point.x + "/" + point.y+")");
|
JMenuItem InfoXY = new JMenuItem("(" + point.x + "/"
|
||||||
|
+ point.y + ")");
|
||||||
Info.addActionListener(new ActionListener() {
|
Info.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GraphMenu.add(InfoXY);
|
GraphMenu.add(InfoXY);
|
||||||
|
|
||||||
if (point.getIcon()instanceof InterfaceSelectablePointIcon) {
|
if (point.getIcon() instanceof InterfaceSelectablePointIcon) {
|
||||||
m_CurrentPointIcon = point.getIcon();
|
m_CurrentPointIcon = point.getIcon();
|
||||||
if (((InterfaceSelectablePointIcon)m_CurrentPointIcon).getSelectionListener() != null) {
|
if (((InterfaceSelectablePointIcon) m_CurrentPointIcon)
|
||||||
|
.getSelectionListener() != null) {
|
||||||
JMenuItem select;
|
JMenuItem select;
|
||||||
AbstractEAIndividual indy = ((InterfaceSelectablePointIcon)m_CurrentPointIcon).getEAIndividual();
|
AbstractEAIndividual indy = ((InterfaceSelectablePointIcon) m_CurrentPointIcon)
|
||||||
if (indy.isMarked()) select = new JMenuItem("Deselect individual");
|
.getEAIndividual();
|
||||||
else select = new JMenuItem("Select individual");
|
if (indy.isMarked())
|
||||||
|
select = new JMenuItem(
|
||||||
|
"Deselect individual");
|
||||||
|
else
|
||||||
|
select = new JMenuItem("Select individual");
|
||||||
select.addActionListener(new ActionListener() {
|
select.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
((InterfaceSelectablePointIcon)m_CurrentPointIcon).getSelectionListener().individualSelected(((InterfaceSelectablePointIcon)m_CurrentPointIcon).getEAIndividual());
|
((InterfaceSelectablePointIcon) m_CurrentPointIcon)
|
||||||
|
.getSelectionListener()
|
||||||
|
.individualSelected(
|
||||||
|
((InterfaceSelectablePointIcon) m_CurrentPointIcon)
|
||||||
|
.getEAIndividual());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GraphMenu.add(select);
|
GraphMenu.add(select);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (point.getIcon()instanceof InterfaceDPointWithContent) {
|
if (point.getIcon() instanceof InterfaceDPointWithContent) {
|
||||||
m_CurrentPointIcon = point.getIcon();
|
m_CurrentPointIcon = point.getIcon();
|
||||||
JMenuItem drawIndy = new JMenuItem("Show individual");
|
JMenuItem drawIndy = new JMenuItem(
|
||||||
|
"Show individual");
|
||||||
drawIndy.addActionListener(new ActionListener() {
|
drawIndy.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
((InterfaceDPointWithContent)m_CurrentPointIcon).showIndividual();
|
((InterfaceDPointWithContent) m_CurrentPointIcon)
|
||||||
|
.showIndividual();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GraphMenu.add(drawIndy);
|
GraphMenu.add(drawIndy);
|
||||||
@ -813,15 +888,19 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
JMenuItem removeGraph = new JMenuItem("Remove graph");
|
JMenuItem removeGraph = new JMenuItem("Remove graph");
|
||||||
removeGraph.addActionListener(new ActionListener() {
|
removeGraph.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
clearGraph(FunctionArea.this.m_x, FunctionArea.this.m_y);
|
clearGraph(FunctionArea.this.m_x,
|
||||||
|
FunctionArea.this.m_y);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GraphMenu.add(removeGraph);
|
GraphMenu.add(removeGraph);
|
||||||
|
|
||||||
JMenuItem changecolorGraph = new JMenuItem("Change color");
|
JMenuItem changecolorGraph = new JMenuItem(
|
||||||
changecolorGraph.addActionListener(new ActionListener() {
|
"Change color");
|
||||||
|
changecolorGraph
|
||||||
|
.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
changeColorGraph(FunctionArea.this.m_x, FunctionArea.this.m_y);
|
changeColorGraph(FunctionArea.this.m_x,
|
||||||
|
FunctionArea.this.m_y);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GraphMenu.add(changecolorGraph);
|
GraphMenu.add(changecolorGraph);
|
||||||
@ -829,7 +908,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
JMenuItem removePoint = new JMenuItem("Remove point");
|
JMenuItem removePoint = new JMenuItem("Remove point");
|
||||||
removePoint.addActionListener(new ActionListener() {
|
removePoint.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
removePoint(FunctionArea.this.m_x, FunctionArea.this.m_y);
|
removePoint(FunctionArea.this.m_x,
|
||||||
|
FunctionArea.this.m_y);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GraphMenu.add(removePoint);
|
GraphMenu.add(removePoint);
|
||||||
@ -840,22 +920,28 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows to add a selection listener to the PointIcon
|
/**
|
||||||
* it should need more than one listener to this abstruse event
|
* This method allows to add a selection listener to the PointIcon it should
|
||||||
* @param a The selection listener
|
* need more than one listener to this abstruse event
|
||||||
|
*
|
||||||
|
* @param a
|
||||||
|
* The selection listener
|
||||||
*/
|
*/
|
||||||
public void addRefPointSelectionListener(InterfaceRefPointListener a) {
|
public void addRefPointSelectionListener(InterfaceRefPointListener a) {
|
||||||
this.m_RefPointListener = a;
|
this.m_RefPointListener = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method returns the selection listener to the PointIcon
|
/**
|
||||||
|
* This method returns the selection listener to the PointIcon
|
||||||
|
*
|
||||||
* @return InterfaceSelectionListener
|
* @return InterfaceSelectionListener
|
||||||
*/
|
*/
|
||||||
public InterfaceRefPointListener getRefPointSelectionListener() {
|
public InterfaceRefPointListener getRefPointSelectionListener() {
|
||||||
return this.m_RefPointListener;
|
return this.m_RefPointListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows to remove the selection listener to the PointIcon
|
/**
|
||||||
|
* This method allows to remove the selection listener to the PointIcon
|
||||||
*/
|
*/
|
||||||
public void removeRefPointSelectionListeners() {
|
public void removeRefPointSelectionListeners() {
|
||||||
this.m_RefPointListener = null;
|
this.m_RefPointListener = null;
|
||||||
@ -878,7 +964,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void toggleLegend() {
|
private void toggleLegend() {
|
||||||
m_legend=!m_legend;
|
m_legend = !m_legend;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user