Closed mokun closed 11 months ago
@larsnaesbye
You are now our astrophysic guru and can you figure out what went wrong with those two comboboxes and how to fix them ?
I don't know how.
I didn't even know the simulation had an OrbitViewer
@larsnaesbye
You are now our astrophysic guru and can you figure out what went wrong with those two comboboxes and how to fix them ?
I don't know how.
Haha! I'm not an astrophysics guru but just a regular IT guy who happens to work now with satellite data. My colleague's an astrophysicist, though, but I don't think I can bother him with non-work related stuff :-)
That being said, I'd like to take a look at this problem.
@larsnaesbye You are now our astrophysic guru and can you figure out what went wrong with those two comboboxes and how to fix them ? I don't know how.
Haha! I'm not an astrophysics guru but just a regular IT guy who happens to work now with satellite data. My colleague's an astrophysicist, though, but I don't think I can bother him with non-work related stuff :-)
ok. at least you work with them daily and i imagine their excess expertise would easily spill onto you :D
I didn't even know the simulation had an OrbitViewer
Yea. Clicking the telescope button on the bottom right would open the OrbitViewer as a JInternalFrame inside the main window.
There are some comparisons I don't understand, for example:
for (int i = 0; i < timeStepCount; i++) {
if ((String)(source.getName()) == timeStepLabel[i]) {
timeStep = timeStepSpan[i];
break;
}
}
In Java, String is an object, so when you compare using ==
you compare object references, not contents. This is most often not what you want as since two created Strings have different object references even if you give them identical content.
String.equals(String) compares contents instead, and it seems like many of the comparisons in actionPerformed
should use it instead. This might populate the location and orbit arrays correctly(?).
@mokun
ok. at least you work with them daily and i imagine their excess expertise would easily spill onto you :D
I hope so. Right now I'm mostly fixing scripts to process RINEX files and some data extraction.
Did it work? I must admit I didn't test it myself.
Did it work? I must admit I didn't test it myself.
I wish it did. Now it's throwing NPE
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.mars_sim.msp.ui.astroarts.OrbitViewer.actionPerformed(OrbitViewer.java:1144)
at java.desktop/javax.swing.JComboBox.fireActionEvent(JComboBox.java:1264)
at java.desktop/javax.swing.JComboBox.contentsChanged(JComboBox.java:1337)
at java.desktop/javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:123)
at java.desktop/javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.java:94)
at java.desktop/javax.swing.DefaultComboBoxModel.addElement(DefaultComboBoxModel.java:132)
at java.desktop/javax.swing.JComboBox.addItem(JComboBox.java:716)
at org.mars_sim.msp.ui.astroarts.OrbitViewer.createGUI(OrbitViewer.java:667)
at org.mars_sim.msp.ui.astroarts.OrbitViewer.<init>(OrbitViewer.java:279)
at org.mars_sim.msp.ui.swing.MainWindow.openOrbitViewer(MainWindow.java:794)
at org.mars_sim.msp.ui.swing.MainWindow$6.actionPerformed(MainWindow.java:825)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at com.alee.laf.button.WButtonInputListener.mouseReleased(WButtonInputListener.java:248)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6635)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6400)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
I can't even open the OrbitViewer by pressing the icon. Nothing happens.
I can't even open the OrbitViewer by pressing the icon. Nothing happens.
I suppose you use linux. Wonder why it behaves this way.
So far, I only tested it on Windows OS.
Next I'll test it in macOS to see what happens.
@larsnaesbye
I just figured out why the comboboxes don't work.
I have wanted to see what the orbit looks like from Mars perspective. But the way the code does is simply moving the planet of choice to (0,0,0) and that' it.
Doing the commit now.
@larsnaesbye , @bevans2000
Can we discuss how we may use this orbit viewer for something more practical in mars-sim ?
I still have a high hope for making use of this orbit viewer.
May be we can use the orbit viewer in the Resupply Tool to decide how long and how much distance a resupply mission will need ?
Visualizing the orbital picture of the trajectory of incoming settlers or any departing settlers to return home and etc. for sure very nice addition.
We sure need more good looking front end UI elements for player to react with the simulation.
@larsnaesbye. Please see this NASA webpage.
On the third picture box, there's this draggable 3D moon and with lines or orbits. It would be cool for us to visualize things like this.
I know it's hard to do anything with Swing. This makes me think of wanting to try JavaFX again in mars-sim, or embedding Javascript in mars-sim.
Thought, we did come up with a JavaFX 3D Mars Globe main menu in the past, the fusion of Swing and JavaFX had been proven quite difficult.
For orbits we just need the orbital parameters. Trajectories....hmmm... do we want to simulate a spinning Earth, a spinning Mars and then make advanced calculations of a supply mission launched from a particular place on Earth (Baikonur, Kourou, Cape Canaveral...) towards a designated landing spot on Mars? That is complex.
For orbits we just need the orbital parameters. Trajectories....hmmm... do we want to simulate a spinning Earth, a spinning Mars and then make advanced calculations of a supply mission launched from a particular place on Earth (Baikonur, Kourou, Cape Canaveral...) towards a designated landing spot on Mars? That is complex.
Yes I'd love to but one step at a time no doubt :).
I'm closing this thread now. We can start a new thread in future for a spinning Mars. And we would need to switch back to JavaFX in order to implement it.
Hope the old JavaFX we used to have had been resolved after they open sourced it.
I've just rearranged the control buttons to look better.
Also, I've made the zoom level to go to the level in which the space between the orbit of Mars and the orbit of Earth is clearly shown. See below :
If we put in some more work, in future, we should be able to plot out the trajectories of any space vehicles between Earth and Mars.
@larsnaesbye @Urwumpe @bevans2000
Note that the mouse scroll is now working to zoom in and out of the solar system.
The left/right button dragging is working but there's a chance that when I drag too much and too fast in flipping it upsides down and downside up many times, it can crash. I haven't figured out a way to recover it when that happens.
Any suggestions on how to prevent that from happening ?
Just rework the DateDialog
to improve clarity as follows :
So far, the solar system is still drawn with our Sun at the center.
At least we've fixed some major lingering bugs and enable a closed up view of Mars on an orbit around the sun. . It may be difficult to change the reference frame to having Mars at the center since it will involve retrograde movements of earth and other planets.
Closing this thread now. Over and out.
Describe the bug
Expected behavior
Screenshots
Desktop (please complete the following information):
Additional context