Merging MK branch revs. 412: Close all windows of common prefix.
This commit is contained in:
parent
e0c6e4067d
commit
4fd8546424
@ -41,6 +41,8 @@ import javax.swing.JOptionPane;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JProgressBar;
|
import javax.swing.JProgressBar;
|
||||||
import javax.swing.JRadioButtonMenuItem;
|
import javax.swing.JRadioButtonMenuItem;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JSeparator;
|
||||||
import javax.swing.JWindow;
|
import javax.swing.JWindow;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
@ -78,7 +80,8 @@ import eva2.tools.jproxy.RemoteStateListener;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EvAClient implements RemoteStateListener, Serializable {
|
public class EvAClient implements RemoteStateListener, Serializable {
|
||||||
final int splashScreenTime = 1500;
|
private final int splashScreenTime = 1500;
|
||||||
|
private final int maxWindowMenuLength = 30;
|
||||||
private static Properties EVA_PROPERTIES;
|
private static Properties EVA_PROPERTIES;
|
||||||
|
|
||||||
public static boolean TRACE = false;
|
public static boolean TRACE = false;
|
||||||
@ -303,7 +306,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (withGUI ) {
|
if (withGUI ) {
|
||||||
m_Frame = new JEFrame();
|
m_Frame = new JEFrame(EvAInfo.productName + " workbench");
|
||||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||||
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation);
|
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation);
|
||||||
try {
|
try {
|
||||||
@ -311,7 +314,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
} catch (java.lang.NullPointerException e) {
|
} catch (java.lang.NullPointerException e) {
|
||||||
System.out.println("Could not find EvA2 icon, please move resources folder to working directory!");
|
System.out.println("Could not find EvA2 icon, please move resources folder to working directory!");
|
||||||
}
|
}
|
||||||
m_Frame.setTitle(EvAInfo.productName + " workbench");
|
// m_Frame.setTitle(EvAInfo.productName + " workbench");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
@ -585,20 +588,45 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
public void menuSelected(MenuEvent e) {
|
public void menuSelected(MenuEvent e) {
|
||||||
// System.out.println("Selected");
|
// System.out.println("Selected");
|
||||||
m_mnuWindow.removeAll();
|
m_mnuWindow.removeAll();
|
||||||
|
JExtMenu curMenu = m_mnuWindow;
|
||||||
|
// JScrollPane jsp = new JScrollPane();
|
||||||
Object[] framelist = JEFrameRegister.getFrameList();
|
Object[] framelist = JEFrameRegister.getFrameList();
|
||||||
for (int i = 0; i < framelist.length; i++) {
|
for (int i = 0; i < framelist.length; i++) {
|
||||||
JMenuItem act = new JMenuItem((i + 1) + ". " + ((JEFrame) framelist[i]).getTitle());
|
JMenuItem act = new JMenuItem((i + 1) + ". " + ((JEFrame) framelist[i]).getTitle());
|
||||||
final JFrame x = ((JEFrame) framelist[i]);
|
final JFrame x = ((JEFrame) framelist[i]);
|
||||||
|
|
||||||
act.addActionListener((new ActionListener() {
|
act.addActionListener((new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (!x.isActive()) {
|
||||||
x.setExtendedState(JFrame.NORMAL);
|
x.setExtendedState(JFrame.NORMAL);
|
||||||
x.toFront();
|
x.setVisible(false);
|
||||||
|
x.setVisible(true); // it seems to be quite a fuss to bring something to the front and actually mean it...
|
||||||
|
x.toFront(); // this seems useless
|
||||||
|
x.requestFocus(); // this seems useless too
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
}));
|
||||||
);
|
if (curMenu.getItemCount()>=maxWindowMenuLength) {
|
||||||
|
JExtMenu subMenu = new JExtMenu("&More...");
|
||||||
|
curMenu.add(new JSeparator());
|
||||||
|
curMenu.add(subMenu);
|
||||||
|
curMenu=subMenu;
|
||||||
|
}
|
||||||
|
curMenu.add(act);
|
||||||
|
}
|
||||||
|
String[] commonPrefixes = JEFrameRegister.getCommonPrefixes(10);
|
||||||
|
if (commonPrefixes.length > 0) m_mnuWindow.add(new JSeparator());
|
||||||
|
for (int i=0; i<commonPrefixes.length; i++) {
|
||||||
|
final String prefix = commonPrefixes[i];
|
||||||
|
JMenuItem act = new JMenuItem("Close all of " + prefix + "...");
|
||||||
|
act.addActionListener((new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JEFrameRegister.closeAllByPrefix(prefix);
|
||||||
|
}
|
||||||
|
}));
|
||||||
m_mnuWindow.add(act);
|
m_mnuWindow.add(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public void menuCanceled(MenuEvent e) {
|
public void menuCanceled(MenuEvent e) {
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,20 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
drawIcon(theIcon, label, position, graphID);
|
drawIcon(theIcon, label, position, graphID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a line with given start and end points.
|
||||||
|
*
|
||||||
|
* @param p1
|
||||||
|
* @param p2
|
||||||
|
*/
|
||||||
|
public void drawLine(double[] p1, double[] p2) {
|
||||||
|
DPointSet popRep = new DPointSet();
|
||||||
|
popRep.setConnected(true);
|
||||||
|
popRep.addDPoint(new DPoint(p1[0], p1[1]));
|
||||||
|
popRep.addDPoint(new DPoint(p2[0], p2[1]));
|
||||||
|
addDElement(popRep);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 and
|
||||||
* a double value. The color corresponds to the color of the graph with given ID
|
* a double value. The color corresponds to the color of the graph with given ID
|
||||||
|
@ -21,24 +21,40 @@ public class JEFrame extends JFrame {
|
|||||||
|
|
||||||
public JEFrame() {
|
public JEFrame() {
|
||||||
super();
|
super();
|
||||||
register();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JEFrame(String name) {
|
public JEFrame(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
register();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register() {
|
@Override
|
||||||
JEFrameRegister.register(this);
|
public void addWindowListener(WindowListener l) {
|
||||||
|
super.addWindowListener(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
this.addWindowListener(new WindowAdapter() {
|
this.addWindowListener(new WindowAdapter() {
|
||||||
public void windowClosing(WindowEvent e) {
|
@Override
|
||||||
JEFrameRegister.unregister((JEFrame) e.getWindow());
|
|
||||||
}
|
|
||||||
public void windowClosed(WindowEvent e) {
|
public void windowClosed(WindowEvent e) {
|
||||||
|
super.windowClosed(e);
|
||||||
JEFrameRegister.unregister((JEFrame) e.getWindow());
|
JEFrameRegister.unregister((JEFrame) e.getWindow());
|
||||||
|
// ((JFrame) e.getWindow()).dispose();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void windowOpened(WindowEvent e) {
|
||||||
|
super.windowOpened(e);
|
||||||
|
JEFrameRegister.register((JEFrame) e.getWindow());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void windowActivated(WindowEvent e) {
|
||||||
|
JEFrameRegister.register((JEFrame) e.getWindow());
|
||||||
|
super.windowActivated(e);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
|
this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_F,Event.CTRL_MASK),
|
KeyStroke.getKeyStroke(KeyEvent.VK_F,Event.CTRL_MASK),
|
||||||
@ -83,10 +99,5 @@ public class JEFrame extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,22 +13,21 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
|
|
||||||
public class JEFrameRegister {
|
public class JEFrameRegister {
|
||||||
|
private static ArrayList<JEFrame> JEFrameList;
|
||||||
private static ArrayList JEFrameList;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
JEFrameList = new ArrayList<JEFrame>();
|
||||||
JEFrameList = new ArrayList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(JEFrame jf) {
|
public static void register(JEFrame jf) {
|
||||||
JEFrameList.add(jf);
|
if (!JEFrameList.contains(jf)) JEFrameList.add(jf);
|
||||||
// System.out.println("reg ! JEFSIZE :" + JEFrameList.size());
|
// System.out.println("reg " + jf.getTitle() + "/" + (jf.hashCode()) + ", list size: " + JEFrameList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unregister(JEFrame jf) {
|
public static void unregister(JEFrame jf) {
|
||||||
JEFrameList.remove(jf);
|
JEFrameList.remove(jf); // Plot windows produce double closing events, so ignore it
|
||||||
// System.out.println("unreg! JEFSIZE :" + JEFrameList.size());
|
// if (!JEFrameList.remove(jf)) System.err.println("Warning: tried to unregister frame " + jf.getTitle() + " which was not registered! (JEFrameRegister)");
|
||||||
|
// System.out.println("unreg " + jf.getTitle() + "/" + jf.hashCode() + ", list size:" + JEFrameList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object[] getFrameList() {
|
public static Object[] getFrameList() {
|
||||||
@ -43,5 +42,36 @@ public class JEFrameRegister {
|
|||||||
toset.toFront();
|
toset.toFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all prefixes which occur at least twice in the registered frame list.
|
||||||
|
* @param prefLen
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String[] getCommonPrefixes(int prefLen) {
|
||||||
|
ArrayList<String> prefixes = new ArrayList<String>();
|
||||||
|
ArrayList<Integer> count = new ArrayList<Integer>();
|
||||||
|
for (int i=0; i<JEFrameList.size(); i++) {
|
||||||
|
String title = JEFrameList.get(i).getTitle();
|
||||||
|
String titPref = title.substring(0, Math.min(prefLen, title.length()));
|
||||||
|
int earlierIndex = prefixes.indexOf(titPref);
|
||||||
|
if (earlierIndex<0) {
|
||||||
|
prefixes.add(titPref);
|
||||||
|
count.add(1);
|
||||||
|
} else count.set(earlierIndex, 1+count.get(earlierIndex));
|
||||||
|
}
|
||||||
|
for (int i=prefixes.size()-1; i>=0; i--) {
|
||||||
|
if (count.get(i)<=1) {
|
||||||
|
prefixes.remove(i);
|
||||||
|
count.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return prefixes.toArray(new String[prefixes.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void closeAllByPrefix(String prefix) {
|
||||||
|
for (int i=0; i<JEFrameList.size(); i++) {
|
||||||
|
String title = JEFrameList.get(i).getTitle();
|
||||||
|
if (title.startsWith(prefix)) JEFrameList.get(i).dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -41,14 +41,10 @@ public class PropertyDialog extends JEFrame {
|
|||||||
try {
|
try {
|
||||||
setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
|
setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
|
||||||
} catch (java.lang.NullPointerException e) {
|
} catch (java.lang.NullPointerException e) {
|
||||||
System.out.println("Could not find EvA2 icon, please move resources folder to working directory!");
|
System.err.println("Could not find EvA2 icon, please move resources folder to working directory!");
|
||||||
}
|
}
|
||||||
//System.out.println("PropertyDialog.Constructor of "+ Title);
|
//System.out.println("PropertyDialog.Constructor of "+ Title);
|
||||||
addWindowListener(new WindowAdapter() {
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
public void windowClosing(WindowEvent e) {
|
|
||||||
e.getWindow().dispose();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
getContentPane().setLayout(new BorderLayout());
|
getContentPane().setLayout(new BorderLayout());
|
||||||
m_Editor = editor;
|
m_Editor = editor;
|
||||||
m_EditorComponent = editor.getCustomEditor();
|
m_EditorComponent = editor.getCustomEditor();
|
||||||
|
@ -21,6 +21,7 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.beans.PropertyEditor;
|
import java.beans.PropertyEditor;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import eva2.tools.EVAHELP;
|
import eva2.tools.EVAHELP;
|
||||||
@ -51,7 +52,13 @@ public class PropertyPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_PropertyDialog.updateFrameTitle(m_PropertyEditor);
|
m_PropertyDialog.updateFrameTitle(m_PropertyEditor);
|
||||||
|
// System.out.println("" + BeanInspector.toString(m_PropertyDialog));
|
||||||
|
m_PropertyDialog.setVisible(false);
|
||||||
|
m_PropertyDialog.setExtendedState(JFrame.NORMAL);
|
||||||
m_PropertyDialog.setVisible(true);
|
m_PropertyDialog.setVisible(true);
|
||||||
|
m_PropertyDialog.requestFocus();
|
||||||
|
// System.out.println("" + BeanInspector.toString(m_PropertyDialog));
|
||||||
|
// System.out.println("Aft: " + m_PropertyDialog.isShowing() + " " + m_PropertyDialog.isVisible() + " " + m_PropertyDialog.isActive() + " " + m_PropertyDialog.isFocused());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,11 @@ package eva2.gui;
|
|||||||
/*==========================================================================*
|
/*==========================================================================*
|
||||||
* IMPORTS
|
* IMPORTS
|
||||||
*==========================================================================*/
|
*==========================================================================*/
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
|
||||||
import eva2.server.go.problems.Interface2DBorderProblem;
|
import eva2.server.go.problems.Interface2DBorderProblem;
|
||||||
import eva2.tools.chart2d.*;
|
import eva2.server.go.problems.InterfaceFirstOrderDerivableProblem;
|
||||||
|
import eva2.tools.chart2d.DRectangle;
|
||||||
import eva2.tools.diagram.ColorBarCalculator;
|
import eva2.tools.diagram.ColorBarCalculator;
|
||||||
import eva2.tools.math.Mathematics;
|
import eva2.tools.math.Mathematics;
|
||||||
|
|
||||||
@ -28,8 +29,8 @@ import eva2.tools.math.Mathematics;
|
|||||||
*/
|
*/
|
||||||
public class TopoPlot extends Plot {
|
public class TopoPlot extends Plot {
|
||||||
|
|
||||||
public int gridx = 50;
|
private int gridx = 50;
|
||||||
public int gridy = 50;
|
private int gridy = 50;
|
||||||
int colorScale = ColorBarCalculator.BLUE_TO_RED;
|
int colorScale = ColorBarCalculator.BLUE_TO_RED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,19 +60,29 @@ public class TopoPlot extends Plot {
|
|||||||
colorScale = color_scale;
|
colorScale = color_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines parameters used for drawing the topology.
|
||||||
|
* @param gridX the x-resolution of the topology, higher value means higher resolution
|
||||||
|
* @param gridY the y-resolution of the topology, higher value means higher resolution
|
||||||
|
*/
|
||||||
|
public void setParams(int gridX, int gridY) {
|
||||||
|
setParams(gridX, gridY, colorScale);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the topology (by setting a specific problem) and draws the topology
|
* Defines the topology (by setting a specific problem) and draws the topology
|
||||||
*/
|
*/
|
||||||
public void setTopology(Interface2DBorderProblem problem) {
|
public void setTopology(Interface2DBorderProblem problem) {
|
||||||
setTopology(problem, problem.get2DBorder());
|
setTopology(problem, problem.get2DBorder(), false);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Defines the topology (by setting a specific problem) and draws the topology
|
* Defines the topology (by setting a specific problem) and draws the topology
|
||||||
*/
|
*/
|
||||||
public void setTopology(Interface2DBorderProblem problem, double[][] border) {
|
public void setTopology(Interface2DBorderProblem problem, double[][] border, boolean withGradientsIfAvailable) {
|
||||||
double[] sizeXY=Mathematics.getAbsRange(border);
|
double[] sizeXY=Mathematics.getAbsRange(border);
|
||||||
double deltaX = sizeXY[0]/gridx;
|
double deltaX = sizeXY[0]/gridx;
|
||||||
double deltaY = sizeXY[1]/gridy;
|
double deltaY = sizeXY[1]/gridy;
|
||||||
|
double maxDeriv=0;
|
||||||
double[] pos = new double[2];
|
double[] pos = new double[2];
|
||||||
//double fitRange = java.lang.Math.abs(problem.getMinFitness()-problem.getMaxFitness() );
|
//double fitRange = java.lang.Math.abs(problem.getMinFitness()-problem.getMaxFitness() );
|
||||||
double fitRange = 0, max = -Double.MAX_VALUE, min = Double.MAX_VALUE, tmp;
|
double fitRange = 0, max = -Double.MAX_VALUE, min = Double.MAX_VALUE, tmp;
|
||||||
@ -82,6 +93,10 @@ public class TopoPlot extends Plot {
|
|||||||
tmp = (float)(problem.functionValue(pos));
|
tmp = (float)(problem.functionValue(pos));
|
||||||
if (tmp < min) min = tmp;
|
if (tmp < min) min = tmp;
|
||||||
if (tmp > max) max = tmp;
|
if (tmp > max) max = tmp;
|
||||||
|
if (problem instanceof InterfaceFirstOrderDerivableProblem) {
|
||||||
|
double[] deriv = ((InterfaceFirstOrderDerivableProblem)problem).getFirstOrderGradients(pos);
|
||||||
|
for (int i=0; i<2;i++) maxDeriv=Math.max(maxDeriv, Math.abs(deriv[i])); // maximum deriv of first 2 dims
|
||||||
|
}
|
||||||
} // for y
|
} // for y
|
||||||
} // for x
|
} // for x
|
||||||
fitRange = java.lang.Math.abs(max - min);
|
fitRange = java.lang.Math.abs(max - min);
|
||||||
@ -92,7 +107,7 @@ public class TopoPlot extends Plot {
|
|||||||
for (int y=0; y<gridy; y++) {
|
for (int y=0; y<gridy; y++) {
|
||||||
pos[0] = border[0][0]+x*deltaX;
|
pos[0] = border[0][0]+x*deltaX;
|
||||||
pos[1] = border[1][0]+y*deltaY;
|
pos[1] = border[1][0]+y*deltaY;
|
||||||
DRectangle rect = new DRectangle(pos[0],pos[1],deltaX,deltaY);
|
DRectangle rect = new DRectangle(pos[0]-(deltaX/2),pos[1]-(deltaY/2),deltaX,deltaY);
|
||||||
Color color = new Color(colorBar.getRGB((float)((problem.functionValue(pos)-min)/fitRange)));
|
Color color = new Color(colorBar.getRGB((float)((problem.functionValue(pos)-min)/fitRange)));
|
||||||
// Color color = new Color(255,(int)(problem.doEvaluation(pos)[0]/fitRange*255),(int)(problem.doEvaluation(pos)[0]/fitRange*255));
|
// Color color = new Color(255,(int)(problem.doEvaluation(pos)[0]/fitRange*255),(int)(problem.doEvaluation(pos)[0]/fitRange*255));
|
||||||
// Color color = new Color(colorBar.getRGB((float)(problem.functionValue(pos)/fitRange))); // Color color = new Color(255,(int)(problem.doEvaluation(pos)[0]/fitRange*255),(int)(problem.doEvaluation(pos)[0]/fitRange*255));
|
// Color color = new Color(colorBar.getRGB((float)(problem.functionValue(pos)/fitRange))); // Color color = new Color(255,(int)(problem.doEvaluation(pos)[0]/fitRange*255),(int)(problem.doEvaluation(pos)[0]/fitRange*255));
|
||||||
@ -101,6 +116,19 @@ public class TopoPlot extends Plot {
|
|||||||
m_PlotArea.addDElement(rect);
|
m_PlotArea.addDElement(rect);
|
||||||
} // for y
|
} // for y
|
||||||
} // for x
|
} // for x
|
||||||
|
if (withGradientsIfAvailable && (problem instanceof InterfaceFirstOrderDerivableProblem)) {
|
||||||
|
for (int x=0; x<gridx; x++) {
|
||||||
|
for (int y=0; y<gridy; y++) {
|
||||||
|
pos[0] = border[0][0]+x*deltaX;
|
||||||
|
pos[1] = border[1][0]+y*deltaY;
|
||||||
|
double[] derivPos = ((InterfaceFirstOrderDerivableProblem)problem).getFirstOrderGradients(pos);
|
||||||
|
Mathematics.svDiv(1.1*(2*maxDeriv/Math.max(deltaX, deltaY)), derivPos, derivPos);
|
||||||
|
Mathematics.vvAdd(pos, derivPos, derivPos);
|
||||||
|
getFunctionArea().drawLine(pos, derivPos);
|
||||||
|
getFunctionArea().drawIcon(1, "", derivPos, 0);
|
||||||
|
} // for y
|
||||||
|
} // for x
|
||||||
|
}
|
||||||
m_Frame.setVisible(true);
|
m_Frame.setVisible(true);
|
||||||
|
|
||||||
} // setTopology
|
} // setTopology
|
||||||
|
@ -760,8 +760,7 @@ public class PostProcess {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
plot = new TopoPlot("PostProcessing: " + title, "x", "y",range[0],range[1]);
|
plot = new TopoPlot("PostProcessing: " + title, "x", "y",range[0],range[1]);
|
||||||
if (prob instanceof Interface2DBorderProblem) {
|
if (prob instanceof Interface2DBorderProblem) {
|
||||||
plot.gridx=60;
|
plot.setParams(60, 60);
|
||||||
plot.gridy=60;
|
|
||||||
plot.setTopology((Interface2DBorderProblem)prob);
|
plot.setTopology((Interface2DBorderProblem)prob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,8 +222,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
|
|||||||
Population pop;
|
Population pop;
|
||||||
|
|
||||||
this.m_Topology = new TopoPlot("CBN-Species at gen. " + gen,"x","y",a,a);
|
this.m_Topology = new TopoPlot("CBN-Species at gen. " + gen,"x","y",a,a);
|
||||||
this.m_Topology.gridx = 60;
|
this.m_Topology.setParams(60, 60);
|
||||||
this.m_Topology.gridy = 60;
|
|
||||||
this.m_Topology.setTopology((Interface2DBorderProblem)this.m_Problem);
|
this.m_Topology.setTopology((Interface2DBorderProblem)this.m_Problem);
|
||||||
//draw the undifferentiated
|
//draw the undifferentiated
|
||||||
for (int i = 0; i < this.m_Undifferentiated.size(); i++) {
|
for (int i = 0; i < this.m_Undifferentiated.size(); i++) {
|
||||||
|
@ -1312,8 +1312,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
|
|||||||
a[1] = 0.0;
|
a[1] = 0.0;
|
||||||
if (topoPlot == null) {
|
if (topoPlot == null) {
|
||||||
this.topoPlot = new TopoPlot("CBN-Species","x","y",a,a);
|
this.topoPlot = new TopoPlot("CBN-Species","x","y",a,a);
|
||||||
this.topoPlot.gridx = 60;
|
this.topoPlot.setParams(60, 60);
|
||||||
this.topoPlot.gridy = 60;
|
|
||||||
this.topoPlot.setTopology((Interface2DBorderProblem)this.m_Problem);
|
this.topoPlot.setTopology((Interface2DBorderProblem)this.m_Problem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user