Fix run sim after config change + fix sim table not updating
This commit is contained in:
parent
b7dc313ee8
commit
2c2a7a2d3b
@ -810,7 +810,7 @@ public class OpenRocketDocument implements ComponentChangeListener {
|
|||||||
listeners.remove(listener);
|
listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fireDocumentChangeEvent(DocumentChangeEvent event) {
|
public void fireDocumentChangeEvent(DocumentChangeEvent event) {
|
||||||
DocumentChangeListener[] array = listeners.toArray(new DocumentChangeListener[0]);
|
DocumentChangeListener[] array = listeners.toArray(new DocumentChangeListener[0]);
|
||||||
for (DocumentChangeListener l : array) {
|
for (DocumentChangeListener l : array) {
|
||||||
l.documentChanged(event);
|
l.documentChanged(event);
|
||||||
|
@ -533,7 +533,8 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : FUTURE : do not hard code the 1200 (maybe even make it configurable by the user)
|
||||||
if( 1200 < currentStatus.getSimulationTime() ){
|
if( 1200 < currentStatus.getSimulationTime() ){
|
||||||
ret = false;
|
ret = false;
|
||||||
log.error("Simulation hit max time (1200s): aborting.");
|
log.error("Simulation hit max time (1200s): aborting.");
|
||||||
|
@ -576,7 +576,7 @@ public class SimulationPanel extends JPanel {
|
|||||||
public void documentChanged(DocumentChangeEvent event) {
|
public void documentChanged(DocumentChangeEvent event) {
|
||||||
if (!(event instanceof SimulationChangeEvent))
|
if (!(event instanceof SimulationChangeEvent))
|
||||||
return;
|
return;
|
||||||
simulationTableModel.fireTableDataChanged();
|
fireMaintainSelection();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ import net.sf.openrocket.aerodynamics.FlightConditions;
|
|||||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||||
import net.sf.openrocket.document.OpenRocketDocument;
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
|
import net.sf.openrocket.document.events.SimulationChangeEvent;
|
||||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||||
import net.sf.openrocket.gui.components.BasicSlider;
|
import net.sf.openrocket.gui.components.BasicSlider;
|
||||||
import net.sf.openrocket.gui.components.ConfigurationComboBox;
|
import net.sf.openrocket.gui.components.ConfigurationComboBox;
|
||||||
@ -216,6 +217,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
rkt.addComponentChangeListener(new ComponentChangeListener() {
|
rkt.addComponentChangeListener(new ComponentChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void componentChanged(ComponentChangeEvent e) {
|
public void componentChanged(ComponentChangeEvent e) {
|
||||||
|
updateExtras();
|
||||||
if (is3d) {
|
if (is3d) {
|
||||||
if (e.isTextureChange()) {
|
if (e.isTextureChange()) {
|
||||||
figure3d.flushTextureCaches();
|
figure3d.flushTextureCaches();
|
||||||
@ -557,7 +559,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the extra data included in the figure. Currently this includes
|
* Updates the extra data included in the figure. Currently this includes
|
||||||
* the CP and CG carets.
|
* the CP and CG carets. Also start the background simulator.
|
||||||
*/
|
*/
|
||||||
private WarningSet warnings = new WarningSet();
|
private WarningSet warnings = new WarningSet();
|
||||||
|
|
||||||
@ -708,7 +710,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
simulation.setFlightConfigurationId( document.getSelectedConfiguration().getId());
|
simulation.setFlightConfigurationId( document.getSelectedConfiguration().getId());
|
||||||
} else
|
} else
|
||||||
System.out.println("using pre-existing simulation");
|
System.out.println("using pre-existing simulation");
|
||||||
|
|
||||||
backgroundSimulationWorker = new BackgroundSimulationWorker(document, simulation);
|
backgroundSimulationWorker = new BackgroundSimulationWorker(document, simulation);
|
||||||
backgroundSimulationExecutor.execute(backgroundSimulationWorker);
|
backgroundSimulationExecutor.execute(backgroundSimulationWorker);
|
||||||
}
|
}
|
||||||
@ -758,12 +760,12 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
// Do nothing if cancelled
|
// Do nothing if cancelled
|
||||||
if (isCancelled() || backgroundSimulationWorker != this)
|
if (isCancelled() || backgroundSimulationWorker != this)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
backgroundSimulationWorker = null;
|
backgroundSimulationWorker = null;
|
||||||
extraText.setFlightData(simulation.getSimulatedData());
|
extraText.setFlightData(simulation.getSimulatedData());
|
||||||
extraText.setCalculatingData(false);
|
extraText.setCalculatingData(false);
|
||||||
figure.repaint();
|
figure.repaint();
|
||||||
figure3d.repaint();
|
figure3d.repaint();
|
||||||
|
document.fireDocumentChangeEvent(new SimulationChangeEvent(simulation));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user