Commit 39649acf authored by Gregor Pintar's avatar Gregor Pintar

Sorting of frequency responses fixed, Closed box -> Enclosed

parent 2984e52d
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>SpeakerSim</groupId>
<artifactId>SpeakerSim</artifactId>
<version>2019-03-20</version>
<version>2019-04-02</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
......
......@@ -361,6 +361,8 @@ public class Driver implements JSONable
{
double SPLdiff = SPL_2_83V - SPL_1W;
// TODO: dipole and sign tricks
horizontalAngle = Math.abs(horizontalAngle);
verticalAngle = Math.abs(verticalAngle);
return Math.min(horizontalAxis(f, horizontalAngle), verticalAxis(f, verticalAngle)) / FRD.response(f, SPLdiff).abs();
}
......
......@@ -1221,7 +1221,7 @@
</Component>
<Component class="javax.swing.JCheckBox" name="closedCheckBox">
<Properties>
<Property name="text" type="java.lang.String" value="Closed back"/>
<Property name="text" type="java.lang.String" value="Enclosed"/>
<Property name="toolTipText" type="java.lang.String" value="Enclosed in it&apos;s own enclousure (tweeter)"/>
</Properties>
<Events>
......
......@@ -1497,7 +1497,7 @@ public class DriverWindow extends javax.swing.JDialog
gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
propertiesPanel.add(invertedCheckBox, gridBagConstraints);
closedCheckBox.setText("Closed back");
closedCheckBox.setText("Enclosed");
closedCheckBox.setToolTipText("Enclosed in it's own enclousure (tweeter)");
closedCheckBox.addChangeListener(new javax.swing.event.ChangeListener()
{
......
......@@ -50,8 +50,13 @@ public class ResponsesWindow extends JDialog
{
model.addAll(driver.vFRD);
}
list.setModel(model);
if (model.getSize() > 0)
{
list.setSelectedIndex(0);
}
list.getSelectionModel().addListSelectionListener(new ListSelectionListener()
{
......@@ -67,7 +72,7 @@ public class ResponsesWindow extends JDialog
@Override
public void mouseClicked(MouseEvent evt)
{
if (evt.getClickCount() == 2)
if (evt.getClickCount() == 2 && list.getSelectedIndices().length == 1)
{
edit();
}
......@@ -198,6 +203,7 @@ public class ResponsesWindow extends JDialog
if (rd != null)
{
model.addElement(rd);
list.setSelectedValue(rd, true);
}
refresh();
}
......
......@@ -290,17 +290,12 @@ public class ResponseData implements JSONable, Comparable<ResponseData>
@Override
public int compareTo(ResponseData o)
{
/*if (horizontalAngle == 0 && verticalAngle == 0)
{
return -1;
}
if (o.horizontalAngle == 0 && o.verticalAngle == 0)
if (horizontalAngle > o.horizontalAngle)
{
return 1;
}*/
}
if (horizontalAngle > o.horizontalAngle)
if (verticalAngle > o.verticalAngle)
{
return 1;
}
......@@ -310,11 +305,6 @@ public class ResponseData implements JSONable, Comparable<ResponseData>
return -1;
}
if (verticalAngle > o.verticalAngle)
{
return 1;
}
if (verticalAngle < o.verticalAngle)
{
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment