Skip to content

Commit

Permalink
Atmosphere layer warning (cancels all other layers opacity)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbodmer committed Dec 31, 2022
1 parent 12d783d commit 9de708a
Show file tree
Hide file tree
Showing 18 changed files with 473 additions and 94 deletions.
2 changes: 1 addition & 1 deletion Packages/deb/jworldwindearth/DEBIAN/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jworldwindearth (1.0-1) UNRELEASED; urgency=medium
jworldwindearth (0.9-1) UNRELEASED; urgency=medium

* Initial release. (Closes: #XXXXXX)

Expand Down
2 changes: 1 addition & 1 deletion Packages/deb/jworldwindearth/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: jworldwindearth
Maintainer: Stephan Bodmer <[email protected]>
Section: misc
Version: 1.0
Version: 0.9
Architecture: all
Depends: default-jre
Description: Google Earth like Java application using the Nasa WorldWind SDK
Expand Down
2 changes: 1 addition & 1 deletion nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ src.dir=src
test.src.dir=test
#--- Custom
platform=amd64
version=1.0
version=0.9
platforms.JDK_11.home= /usr/lib/jvm/java-1.11.0-openjdk-amd64
8 changes: 8 additions & 0 deletions src/gov/nasa/atmosphere/JAtmosphereWWEPlugin.form
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="LB_Warning">
<Properties>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="c8" id="orange" palette="1" red="ff" type="palette"/>
</Property>
<Property name="text" type="java.lang.String" value="Atmosphere layer will cancel all other layer opacity... (bug ?)"/>
</Properties>
</Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
Expand Down
41 changes: 38 additions & 3 deletions src/gov/nasa/atmosphere/JAtmosphereWWEPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import gov.nasa.worldwind.terrain.Tessellator;
import java.awt.BorderLayout;
import java.io.InputStream;
import javax.swing.JDesktopPane;
import javax.swing.JLayeredPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.worldwindearth.WWEInputHandler;
Expand All @@ -50,12 +52,12 @@
* @author sbodmer
*/
public class JAtmosphereWWEPlugin extends JPanel implements WWEPlugin, ActionListener, PositionListener, ChangeListener {

App app = null;
WWEFactory factory = null;
WorldWindow ww = null;
Vec4 eyePoint = null;

SunPositionProvider sunPositionProvider = new BasicSunPositionProvider();
RectangularNormalTessellator tessellator = new RectangularNormalTessellator();

Expand All @@ -67,6 +69,13 @@ public class JAtmosphereWWEPlugin extends JPanel implements WWEPlugin, ActionLis
JCircle ele = null;
WorldWindowGLJPanel pww = null;
SunshadingLayer player = new SunshadingLayer(); //--- Preview

/**
* Used desktop pane
*/
JDesktopPane jd = null;
javax.swing.Timer timer = null; //--- Warning timer

/**
*
*/
Expand Down Expand Up @@ -116,6 +125,15 @@ public WWEFactory getPluginFactory() {
public void setup(App app, Object arg) {
this.app = app;

jd = (JDesktopPane) arg;
timer = new javax.swing.Timer(15000, this);
timer.setRepeats(false);

//--- For infoirmation purpose, display the opacity warning
LB_Warning.setVisible(false);
LB_Warning.setSize(LB_Warning.getPreferredSize());
jd.add(LB_Warning, JLayeredPane.PALETTE_LAYER);

layer.setName("Atmosphere");

BT_Light.addActionListener(this);
Expand Down Expand Up @@ -182,6 +200,7 @@ public void cleanup() {
player.dispose();

layer.dispose();
timer.stop();

}

Expand Down Expand Up @@ -215,10 +234,18 @@ public Object doAction(String action, Object argument, Object subject) {
ww.addPositionListener(this);
ww.getModel().getGlobe().setTessellator(tessellator);

//--- There is a bug in the atmospher renderfing, the alpha channel will
//--- be ignored
int width = jd.getWidth();

LB_Warning.setLocation(jd.getWidth()/2-LB_Warning.getWidth()/2, 10);
LB_Warning.setVisible(true);
timer.restart();

} else if (action.equals(DO_ACTION_LAYER_DISABLED)) {
ww.removePositionListener(this);
ww.getModel().getGlobe().setTessellator(null);
LB_Warning.setVisible(false);

}
return null;
Expand Down Expand Up @@ -247,7 +274,10 @@ public void layerMouseClicked(MouseEvent e, gov.nasa.worldwind.geom.Position pos
//**************************************************************************
@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("light")
if (e.getSource() == timer) {
LB_Warning.setVisible(false);

} else if (e.getActionCommand().equals("light")
|| e.getActionCommand().equals("shade")) {
Color c = JColorChooser.showDialog(PN_Config, "Choose a color...", ((JButton) e.getSource()).getBackground());
if (c != null) {
Expand Down Expand Up @@ -319,6 +349,7 @@ private void initComponents() {
PN_Preview = new javax.swing.JPanel();
PN_Elevation = new javax.swing.JPanel();
PN_Azimut = new javax.swing.JPanel();
LB_Warning = new javax.swing.JLabel();

BT_Light.setBackground(java.awt.Color.white);
BT_Light.setActionCommand("light");
Expand Down Expand Up @@ -455,6 +486,9 @@ private void initComponents() {
.addContainerGap())
);

LB_Warning.setForeground(java.awt.Color.orange);
LB_Warning.setText("Atmosphere layer will cancel all other layer opacity... (bug ?)");

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
Expand All @@ -475,6 +509,7 @@ private void initComponents() {
private javax.swing.JRadioButton BT_Relative;
private javax.swing.JButton BT_Shade;
private javax.swing.JCheckBox CB_LensFlare;
private javax.swing.JLabel LB_Warning;
private javax.swing.JPanel PN_Azimut;
private javax.swing.JPanel PN_Config;
private javax.swing.JPanel PN_Elevation;
Expand Down
10 changes: 5 additions & 5 deletions src/gov/nasa/wms/JWMSWWEFactory.form
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<Property name="toolTipText" type="java.lang.String" value="add"/>
<Property name="actionCommand" type="java.lang.String" value="add"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
</Properties>
</Component>
Expand All @@ -120,7 +120,7 @@
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
Expand All @@ -138,7 +138,7 @@
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
Expand All @@ -156,7 +156,7 @@
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
Expand All @@ -174,7 +174,7 @@
<Property name="toolTipText" type="java.lang.String" value="delete"/>
<Property name="actionCommand" type="java.lang.String" value="delete"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
</Properties>
</Component>
Expand Down
10 changes: 5 additions & 5 deletions src/gov/nasa/wms/JWMSWWEFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {
BT_Add.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/worldwindearth/Resources/Icons/add.png"))); // NOI18N
BT_Add.setToolTipText("add");
BT_Add.setActionCommand("add");
BT_Add.setPreferredSize(new java.awt.Dimension(26, 26));
BT_Add.setPreferredSize(new java.awt.Dimension(32, 32));
TB_Tools.add(BT_Add);

BT_Up.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
Expand All @@ -345,7 +345,7 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {
BT_Up.setActionCommand("up");
BT_Up.setFocusable(false);
BT_Up.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
BT_Up.setPreferredSize(new java.awt.Dimension(26, 26));
BT_Up.setPreferredSize(new java.awt.Dimension(32, 32));
BT_Up.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
TB_Tools.add(BT_Up);

Expand All @@ -355,7 +355,7 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {
BT_Down.setActionCommand("down");
BT_Down.setFocusable(false);
BT_Down.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
BT_Down.setPreferredSize(new java.awt.Dimension(26, 26));
BT_Down.setPreferredSize(new java.awt.Dimension(32, 32));
BT_Down.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
TB_Tools.add(BT_Down);

Expand All @@ -365,7 +365,7 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {
BT_Edit.setActionCommand("edit");
BT_Edit.setFocusable(false);
BT_Edit.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
BT_Edit.setPreferredSize(new java.awt.Dimension(26, 26));
BT_Edit.setPreferredSize(new java.awt.Dimension(32, 32));
BT_Edit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
TB_Tools.add(BT_Edit);
TB_Tools.add(jSeparator9);
Expand All @@ -374,7 +374,7 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {
BT_Delete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/worldwindearth/Resources/Icons/remove.png"))); // NOI18N
BT_Delete.setToolTipText("delete");
BT_Delete.setActionCommand("delete");
BT_Delete.setPreferredSize(new java.awt.Dimension(26, 26));
BT_Delete.setPreferredSize(new java.awt.Dimension(32, 32));
TB_Tools.add(BT_Delete);

PN_Servers.add(TB_Tools, java.awt.BorderLayout.PAGE_START);
Expand Down
10 changes: 5 additions & 5 deletions src/org/osmbuildings/JOSMBuildingsWWEFactory.form
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
<Property name="toolTipText" type="java.lang.String" value="add"/>
<Property name="actionCommand" type="java.lang.String" value="add"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
</Properties>
</Component>
Expand All @@ -386,7 +386,7 @@
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
Expand All @@ -404,7 +404,7 @@
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
Expand All @@ -422,7 +422,7 @@
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
Expand All @@ -440,7 +440,7 @@
<Property name="toolTipText" type="java.lang.String" value="delete"/>
<Property name="actionCommand" type="java.lang.String" value="delete"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
<Dimension value="[32, 32]"/>
</Property>
</Properties>
</Component>
Expand Down
Loading

0 comments on commit 9de708a

Please sign in to comment.