Skip to content

Commit bded4d0

Browse files
committed
Formatting adjustments
1 parent 9f047a2 commit bded4d0

File tree

5 files changed

+113
-152
lines changed

5 files changed

+113
-152
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
main.class=gov.nasa.worldwindx.examples.GeoRSS
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
main.class=gov.nasa.worldwindx.examples.ViewControls
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
main.class=gov.nasa.worldwindx.examples.WorldWindDiagnostics

src/gov/nasa/worldwindx/examples/GeoRSS.java

Lines changed: 71 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -16,103 +16,102 @@
1616
* @author dcollins
1717
* @version $Id: GeoRSS.java 2109 2014-06-30 16:52:38Z tgaskins $
1818
*/
19-
public class GeoRSS extends ApplicationTemplate
20-
{
21-
private static class AppFrame extends ApplicationTemplate.AppFrame
22-
{
23-
public AppFrame()
24-
{
19+
public class GeoRSS extends ApplicationTemplate {
20+
21+
private static class AppFrame extends ApplicationTemplate.AppFrame {
22+
23+
public AppFrame() {
2524
super(true, true, false);
2625

2726
RenderableLayer layer = this.buildGeoRSSLayer();
2827
layer.setName("GeoRSS Shapes");
2928
insertBeforePlacenames(this.getWwd(), layer);
3029
}
3130

32-
private RenderableLayer buildGeoRSSLayer()
33-
{
31+
private RenderableLayer buildGeoRSSLayer() {
3432
RenderableLayer layer = new RenderableLayer();
3533
java.util.List<Renderable> shapes;
3634

3735
shapes = GeoRSSParser.parseShapes(GeoRSS_DOCSTRING_A);
38-
if (shapes != null)
36+
if (shapes != null) {
3937
addRenderables(layer, shapes);
38+
}
4039

4140
shapes = GeoRSSParser.parseShapes(GeoRSS_DOCSTRING_B);
42-
if (shapes != null)
41+
if (shapes != null) {
4342
addRenderables(layer, shapes);
43+
}
4444

4545
return layer;
4646
}
4747

48-
private void addRenderables(RenderableLayer layer, Iterable<Renderable> renderables)
49-
{
50-
for (Renderable r : renderables)
48+
private void addRenderables(RenderableLayer layer, Iterable<Renderable> renderables) {
49+
for (Renderable r : renderables) {
5150
layer.addRenderable(r);
51+
}
5252
}
5353
}
5454

55-
private static final String GeoRSS_DOCSTRING_A =
56-
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
57-
"<feed xmlns=\"http://www.w3.org/2005/Atom\"" +
58-
" xmlns:georss=\"http://www.georss.org/georss\"" +
59-
" xmlns:gml=\"http://www.opengis.net/gml\">" +
60-
" <title>Earthquakes</title>" +
61-
" <subtitle>International earthquake observation labs</subtitle>" +
62-
" <link href=\"http://example.org/\"/>" +
63-
" <updated>2005-12-13T18:30:02Z</updated>" +
64-
" <author>" +
65-
" <name>Dr. Thaddeus Remor</name>" +
66-
" <email>tremor@quakelab.edu</email>" +
67-
" </author>" +
68-
" <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>" +
69-
" <entry>" +
70-
" <title>M 3.2, Mona Passage</title>" +
71-
" <link href=\"http://example.org/2005/09/09/atom01\"/>" +
72-
" <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>" +
73-
" <updated>2005-08-17T07:02:32Z</updated>" +
74-
" <summary>We just had a big one.</summary>" +
75-
" <georss:where>" +
76-
" <gml:Polygon>" +
77-
" <gml:exterior>" +
78-
" <gml:LinearRing>" +
79-
" <gml:posList>" +
80-
" 45.256 -110.45 46.46 -109.48 43.84 -109.86 45.256 -110.45" +
81-
" </gml:posList>" +
82-
" </gml:LinearRing>" +
83-
" </gml:exterior>" +
84-
" </gml:Polygon>" +
85-
" </georss:where>" +
86-
" </entry>" +
87-
"</feed>";
55+
private static final String GeoRSS_DOCSTRING_A
56+
= "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
57+
+ "<feed xmlns=\"http://www.w3.org/2005/Atom\""
58+
+ " xmlns:georss=\"http://www.georss.org/georss\""
59+
+ " xmlns:gml=\"http://www.opengis.net/gml\">"
60+
+ " <title>Earthquakes</title>"
61+
+ " <subtitle>International earthquake observation labs</subtitle>"
62+
+ " <link href=\"http://example.org/\"/>"
63+
+ " <updated>2005-12-13T18:30:02Z</updated>"
64+
+ " <author>"
65+
+ " <name>Dr. Thaddeus Remor</name>"
66+
+ " <email>tremor@quakelab.edu</email>"
67+
+ " </author>"
68+
+ " <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>"
69+
+ " <entry>"
70+
+ " <title>M 3.2, Mona Passage</title>"
71+
+ " <link href=\"http://example.org/2005/09/09/atom01\"/>"
72+
+ " <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>"
73+
+ " <updated>2005-08-17T07:02:32Z</updated>"
74+
+ " <summary>We just had a big one.</summary>"
75+
+ " <georss:where>"
76+
+ " <gml:Polygon>"
77+
+ " <gml:exterior>"
78+
+ " <gml:LinearRing>"
79+
+ " <gml:posList>"
80+
+ " 45.256 -110.45 46.46 -109.48 43.84 -109.86 45.256 -110.45"
81+
+ " </gml:posList>"
82+
+ " </gml:LinearRing>"
83+
+ " </gml:exterior>"
84+
+ " </gml:Polygon>"
85+
+ " </georss:where>"
86+
+ " </entry>"
87+
+ "</feed>";
8888

89-
private static final String GeoRSS_DOCSTRING_B =
90-
"<feed xmlns=\"http://www.w3.org/2005/Atom\"" +
91-
" xmlns:georss=\"http://www.georss.org/georss\">" +
92-
" <title>scribble</title>" +
93-
" <id>http://example.com/atom</id>" +
94-
" <author><name>Christopher Schmidt</name></author>" +
95-
"<entry>" +
96-
" <id>http://example.com/19.atom</id>" +
97-
" <link href=\"http://example.com/19.html\"/>" +
98-
" <title>Feature #19</title>" +
99-
" <content type=\"html\">Some content.</content>" +
100-
" <georss:line>" +
101-
" 23.1811523438 -159.609375 " +
102-
" 22.5 -161.564941406 " +
103-
" 20.654296875 -160.422363281 " +
104-
" 18.4350585938 -156.247558594 " +
105-
" 18.3471679688 -154.731445312 " +
106-
" 19.951171875 -153.588867188 " +
107-
" 21.8188476562 -155.983886719" +
108-
" 23.02734375 -158.994140625" +
109-
" 23.0932617188 -159.631347656" +
110-
" </georss:line>" +
111-
"</entry>" +
112-
"</feed>";
89+
private static final String GeoRSS_DOCSTRING_B
90+
= "<feed xmlns=\"http://www.w3.org/2005/Atom\""
91+
+ " xmlns:georss=\"http://www.georss.org/georss\">"
92+
+ " <title>scribble</title>"
93+
+ " <id>http://example.com/atom</id>"
94+
+ " <author><name>Christopher Schmidt</name></author>"
95+
+ "<entry>"
96+
+ " <id>http://example.com/19.atom</id>"
97+
+ " <link href=\"http://example.com/19.html\"/>"
98+
+ " <title>Feature #19</title>"
99+
+ " <content type=\"html\">Some content.</content>"
100+
+ " <georss:line>"
101+
+ " 23.1811523438 -159.609375 "
102+
+ " 22.5 -161.564941406 "
103+
+ " 20.654296875 -160.422363281 "
104+
+ " 18.4350585938 -156.247558594 "
105+
+ " 18.3471679688 -154.731445312 "
106+
+ " 19.951171875 -153.588867188 "
107+
+ " 21.8188476562 -155.983886719"
108+
+ " 23.02734375 -158.994140625"
109+
+ " 23.0932617188 -159.631347656"
110+
+ " </georss:line>"
111+
+ "</entry>"
112+
+ "</feed>";
113113

114-
public static void main(String[] args)
115-
{
114+
public static void main(String[] args) {
116115
ApplicationTemplate.start("WorldWind GeoRSS", AppFrame.class);
117116
}
118117
}

src/gov/nasa/worldwindx/examples/ViewControls.java

Lines changed: 39 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,27 @@
1515
import java.awt.event.*;
1616

1717
/**
18-
* Shows the {@link gov.nasa.worldwind.layers.ViewControlsLayer} and allows you to adjust its size, orientation,
19-
* and available controls.
18+
* Shows the {@link gov.nasa.worldwind.layers.ViewControlsLayer} and allows you to adjust its size, orientation, and
19+
* available controls.
2020
*
2121
* @author Patrick Murris
2222
* @version $Id: ViewControls.java 2109 2014-06-30 16:52:38Z tgaskins $
2323
* @see gov.nasa.worldwind.layers.ViewControlsLayer
2424
* @see gov.nasa.worldwind.layers.ViewControlsSelectListener
2525
* @see gov.nasa.worldwind.layers.CompassLayer
2626
*/
27-
public class ViewControls extends ApplicationTemplate
28-
{
29-
public static class AppFrame extends ApplicationTemplate.AppFrame
30-
{
27+
public class ViewControls extends ApplicationTemplate {
28+
29+
public static class AppFrame extends ApplicationTemplate.AppFrame {
30+
3131
protected ViewControlsLayer viewControlsLayer;
3232

33-
public AppFrame()
34-
{
33+
public AppFrame() {
3534
super(true, true, false);
3635

3736
// Find ViewControls layer and keep reference to it
38-
for (Layer layer : this.getWwd().getModel().getLayers())
39-
{
40-
if (layer instanceof ViewControlsLayer)
41-
{
37+
for (Layer layer : this.getWwd().getModel().getLayers()) {
38+
if (layer instanceof ViewControlsLayer) {
4239
viewControlsLayer = (ViewControlsLayer) layer;
4340
}
4441
}
@@ -47,12 +44,11 @@ public AppFrame()
4744
this.getControlPanel().add(makeControlPanel(), BorderLayout.SOUTH);
4845
}
4946

50-
private JPanel makeControlPanel()
51-
{
47+
private JPanel makeControlPanel() {
5248
JPanel controlPanel = new JPanel();
5349
controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.Y_AXIS));
5450
controlPanel.setBorder(
55-
new CompoundBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9), new TitledBorder("View Controls")));
51+
new CompoundBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9), new TitledBorder("View Controls")));
5652
controlPanel.setToolTipText("Select active view controls");
5753

5854
// Radio buttons - layout
@@ -61,24 +57,16 @@ private JPanel makeControlPanel()
6157
ButtonGroup group = new ButtonGroup();
6258
JRadioButton button = new JRadioButton("Horizontal", true);
6359
group.add(button);
64-
button.addActionListener(new ActionListener()
65-
{
66-
public void actionPerformed(ActionEvent actionEvent)
67-
{
68-
viewControlsLayer.setLayout(AVKey.HORIZONTAL);
69-
getWwd().redraw();
70-
}
60+
button.addActionListener((ActionEvent actionEvent) -> {
61+
viewControlsLayer.setLayout(AVKey.HORIZONTAL);
62+
getWwd().redraw();
7163
});
7264
layoutPanel.add(button);
7365
button = new JRadioButton("Vertical", false);
7466
group.add(button);
75-
button.addActionListener(new ActionListener()
76-
{
77-
public void actionPerformed(ActionEvent actionEvent)
78-
{
79-
viewControlsLayer.setLayout(AVKey.VERTICAL);
80-
getWwd().redraw();
81-
}
67+
button.addActionListener((ActionEvent actionEvent) -> {
68+
viewControlsLayer.setLayout(AVKey.VERTICAL);
69+
getWwd().redraw();
8270
});
8371
layoutPanel.add(button);
8472

@@ -87,13 +75,9 @@ public void actionPerformed(ActionEvent actionEvent)
8775
scalePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
8876
scalePanel.add(new JLabel("Scale:"));
8977
JSlider scaleSlider = new JSlider(1, 20, 10);
90-
scaleSlider.addChangeListener(new ChangeListener()
91-
{
92-
public void stateChanged(ChangeEvent event)
93-
{
94-
viewControlsLayer.setScale(((JSlider) event.getSource()).getValue() / 10d);
95-
getWwd().redraw();
96-
}
78+
scaleSlider.addChangeListener((ChangeEvent event) -> {
79+
viewControlsLayer.setScale(((JSlider) event.getSource()).getValue() / 10d);
80+
getWwd().redraw();
9781
});
9882
scalePanel.add(scaleSlider);
9983

@@ -103,73 +87,49 @@ public void stateChanged(ChangeEvent event)
10387

10488
JCheckBox check = new JCheckBox("Pan");
10589
check.setSelected(true);
106-
check.addActionListener(new ActionListener()
107-
{
108-
public void actionPerformed(ActionEvent actionEvent)
109-
{
110-
viewControlsLayer.setShowPanControls(((JCheckBox) actionEvent.getSource()).isSelected());
111-
getWwd().redraw();
112-
}
90+
check.addActionListener((ActionEvent actionEvent) -> {
91+
viewControlsLayer.setShowPanControls(((JCheckBox) actionEvent.getSource()).isSelected());
92+
getWwd().redraw();
11393
});
11494
checkPanel.add(check);
11595

11696
check = new JCheckBox("Look");
11797
check.setSelected(false);
118-
check.addActionListener(new ActionListener()
119-
{
120-
public void actionPerformed(ActionEvent actionEvent)
121-
{
122-
viewControlsLayer.setShowLookControls(((JCheckBox) actionEvent.getSource()).isSelected());
123-
getWwd().redraw();
124-
}
98+
check.addActionListener((ActionEvent actionEvent) -> {
99+
viewControlsLayer.setShowLookControls(((JCheckBox) actionEvent.getSource()).isSelected());
100+
getWwd().redraw();
125101
});
126102
checkPanel.add(check);
127103

128104
check = new JCheckBox("Zoom");
129105
check.setSelected(true);
130-
check.addActionListener(new ActionListener()
131-
{
132-
public void actionPerformed(ActionEvent actionEvent)
133-
{
134-
viewControlsLayer.setShowZoomControls(((JCheckBox) actionEvent.getSource()).isSelected());
135-
getWwd().redraw();
136-
}
106+
check.addActionListener((ActionEvent actionEvent) -> {
107+
viewControlsLayer.setShowZoomControls(((JCheckBox) actionEvent.getSource()).isSelected());
108+
getWwd().redraw();
137109
});
138110
checkPanel.add(check);
139111

140112
check = new JCheckBox("Heading");
141113
check.setSelected(true);
142-
check.addActionListener(new ActionListener()
143-
{
144-
public void actionPerformed(ActionEvent actionEvent)
145-
{
146-
viewControlsLayer.setShowHeadingControls(((JCheckBox) actionEvent.getSource()).isSelected());
147-
getWwd().redraw();
148-
}
114+
check.addActionListener((ActionEvent actionEvent) -> {
115+
viewControlsLayer.setShowHeadingControls(((JCheckBox) actionEvent.getSource()).isSelected());
116+
getWwd().redraw();
149117
});
150118
checkPanel.add(check);
151119

152120
check = new JCheckBox("Pitch");
153121
check.setSelected(true);
154-
check.addActionListener(new ActionListener()
155-
{
156-
public void actionPerformed(ActionEvent actionEvent)
157-
{
158-
viewControlsLayer.setShowPitchControls(((JCheckBox) actionEvent.getSource()).isSelected());
159-
getWwd().redraw();
160-
}
122+
check.addActionListener((ActionEvent actionEvent) -> {
123+
viewControlsLayer.setShowPitchControls(((JCheckBox) actionEvent.getSource()).isSelected());
124+
getWwd().redraw();
161125
});
162126
checkPanel.add(check);
163127

164128
check = new JCheckBox("Field of view");
165129
check.setSelected(false);
166-
check.addActionListener(new ActionListener()
167-
{
168-
public void actionPerformed(ActionEvent actionEvent)
169-
{
170-
viewControlsLayer.setShowFovControls(((JCheckBox) actionEvent.getSource()).isSelected());
171-
getWwd().redraw();
172-
}
130+
check.addActionListener((ActionEvent actionEvent) -> {
131+
viewControlsLayer.setShowFovControls(((JCheckBox) actionEvent.getSource()).isSelected());
132+
getWwd().redraw();
173133
});
174134
checkPanel.add(check);
175135

@@ -180,8 +140,7 @@ public void actionPerformed(ActionEvent actionEvent)
180140
}
181141
}
182142

183-
public static void main(String[] args)
184-
{
143+
public static void main(String[] args) {
185144
ApplicationTemplate.start("WorldWind View Controls", AppFrame.class);
186145
}
187146
}

0 commit comments

Comments
 (0)