Skip to content

Commit 53e51a2

Browse files
authored
Merge pull request #179 from NASAWorldWind/source-formatting
Update the code formatting to be more conformant
2 parents 1e4713e + 4c81997 commit 53e51a2

File tree

1,821 files changed

+127651
-164256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,821 files changed

+127651
-164256
lines changed

src/com/zebraimaging/ZebraInputHandler.java

Lines changed: 102 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -14,163 +14,158 @@
1414
* not expected to create instances of this class directly or call its methods. To use it, specify it as the
1515
* gov.nasa.worldwind.avkey.InputHandlerClassName in the WorldWind configuration file.
1616
*/
17-
public class ZebraInputHandler extends AWTInputHandler
18-
{
19-
/** All instantiations of this class are stored for internal retrieval. */
17+
public class ZebraInputHandler extends AWTInputHandler {
18+
19+
/**
20+
* All instantiations of this class are stored for internal retrieval.
21+
*/
2022
private static List<ZebraInputHandler> instances = new ArrayList<ZebraInputHandler>();
2123
private static Timer repaintContextsTimer = null;
22-
23-
final static TimerTask repaintContextsTask = new TimerTask()
24-
{
25-
public void run()
26-
{
27-
Iterator<ZebraInputHandler> itr = instances.iterator();
28-
while (itr.hasNext())
29-
{
30-
ZebraInputHandler h = itr.next();
31-
if (h.NeedsRefresh() == true)
32-
{
33-
h.SetRefresh(false);
34-
h.getWorldWindow().redraw();
35-
}
36-
}
37-
}
38-
};
39-
40-
private long hwnd = 0;
41-
private boolean arGL2Present = false;
24+
25+
final static TimerTask repaintContextsTask = new TimerTask() {
26+
public void run() {
27+
Iterator<ZebraInputHandler> itr = instances.iterator();
28+
while (itr.hasNext()) {
29+
ZebraInputHandler h = itr.next();
30+
if (h.NeedsRefresh() == true) {
31+
h.SetRefresh(false);
32+
h.getWorldWindow().redraw();
33+
}
34+
}
35+
}
36+
};
37+
38+
private long hwnd = 0;
39+
private boolean arGL2Present = false;
4240
private boolean refresh = false;
43-
44-
public ZebraInputHandler()
45-
{
41+
42+
public ZebraInputHandler() {
4643
/**
47-
* Attempt to load zebraIntegrator. If it's not found, assume we're either:
48-
* (a) Not connected to the Zebra UPSD Dynamic Display.
49-
* (b) Not using the Zebra integration tools.
44+
* Attempt to load zebraIntegrator. If it's not found, assume we're either: (a) Not connected to the Zebra UPSD
45+
* Dynamic Display. (b) Not using the Zebra integration tools.
5046
*/
51-
try
52-
{
47+
try {
5348
System.loadLibrary("arGL2Integrator");
5449
arGL2Present = true;
5550
instances.add(this);
5651
System.out.println("Loaded arGL2Integrator successfully");
57-
}
58-
catch (UnsatisfiedLinkError e)
59-
{
52+
} catch (UnsatisfiedLinkError e) {
6053
System.out.println("FAILED to load arGL2Integrator.dll");
6154
}
62-
63-
if (repaintContextsTimer == null)
64-
{
65-
repaintContextsTimer = new Timer();
66-
repaintContextsTimer.scheduleAtFixedRate(repaintContextsTask, 0, 10);
55+
56+
if (repaintContextsTimer == null) {
57+
repaintContextsTimer = new Timer();
58+
repaintContextsTimer.scheduleAtFixedRate(repaintContextsTask, 0, 10);
6759
}
6860
}
6961

70-
private synchronized void SetRefresh(boolean value)
71-
{
72-
refresh = value;
62+
private synchronized void SetRefresh(boolean value) {
63+
refresh = value;
7364
}
74-
75-
private synchronized boolean NeedsRefresh()
76-
{
77-
return refresh;
78-
}
79-
80-
public void keyPressed(KeyEvent e)
81-
{
65+
66+
private synchronized boolean NeedsRefresh() {
67+
return refresh;
68+
}
69+
70+
public void keyPressed(KeyEvent e) {
8271
boolean consumed = false;
83-
if (arGL2Present)
72+
if (arGL2Present) {
8473
consumed = zebraKeyPressed(getGLCanvasHandle(), e.getKeyCode());
85-
if (consumed == true)
74+
}
75+
if (consumed == true) {
8676
e.consume();
87-
else
77+
} else {
8878
super.keyPressed(e);
79+
}
8980
}
9081

91-
public void keyReleased(KeyEvent e)
92-
{
82+
public void keyReleased(KeyEvent e) {
9383
boolean consumed = false;
94-
if (arGL2Present)
84+
if (arGL2Present) {
9585
consumed = zebraKeyReleased(getGLCanvasHandle(), e.getKeyCode());
96-
if (consumed == true)
86+
}
87+
if (consumed == true) {
9788
e.consume();
98-
else
89+
} else {
9990
super.keyReleased(e);
91+
}
10092
}
10193

102-
public void mouseClicked(MouseEvent e)
103-
{
94+
public void mouseClicked(MouseEvent e) {
10495
boolean consumed = false;
105-
if (arGL2Present)
96+
if (arGL2Present) {
10697
consumed = zebraMouseReleased(getGLCanvasHandle(), e.getButton(), e.getX(), e.getY());
107-
if (consumed == true)
98+
}
99+
if (consumed == true) {
108100
e.consume();
109-
else
101+
} else {
110102
super.mouseClicked(e);
103+
}
111104
}
112105

113-
public void mousePressed(MouseEvent e)
114-
{
106+
public void mousePressed(MouseEvent e) {
115107
boolean consumed = false;
116-
if (arGL2Present)
108+
if (arGL2Present) {
117109
consumed = zebraMousePressed(getGLCanvasHandle(), e.getButton(), e.getX(), e.getY());
118-
if (consumed == true)
110+
}
111+
if (consumed == true) {
119112
e.consume();
120-
else
113+
} else {
121114
super.mousePressed(e);
115+
}
122116
}
123117

124-
public void mouseReleased(MouseEvent e)
125-
{
118+
public void mouseReleased(MouseEvent e) {
126119
boolean consumed = false;
127-
if (arGL2Present)
120+
if (arGL2Present) {
128121
consumed = zebraMouseReleased(getGLCanvasHandle(), e.getButton(), e.getX(), e.getY());
129-
if (consumed == true)
122+
}
123+
if (consumed == true) {
130124
e.consume();
131-
else
125+
} else {
132126
super.mouseReleased(e);
127+
}
133128
}
134129

135-
public void mouseDragged(MouseEvent e)
136-
{
137-
/** The mouseDragged event does not populate the button field of MouseEvent. Therefore it must be done manually. */
130+
public void mouseDragged(MouseEvent e) {
131+
/**
132+
* The mouseDragged event does not populate the button field of MouseEvent. Therefore it must be done manually.
133+
*/
138134
int button = 0;
139135
button = (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK ? 1 : button;
140136
button = (e.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK ? 2 : button;
141137
button = (e.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK ? 3 : button;
142138

143139
boolean consumed = false;
144-
if (arGL2Present)
140+
if (arGL2Present) {
145141
consumed = zebraMouseMoved(getGLCanvasHandle(), button, e.getX(), e.getY());
146-
if (consumed == true)
142+
}
143+
if (consumed == true) {
147144
e.consume();
148-
else
145+
} else {
149146
super.mouseDragged(e);
147+
}
150148
}
151149

152-
public void mouseWheelMoved(MouseWheelEvent e)
153-
{
150+
public void mouseWheelMoved(MouseWheelEvent e) {
154151
boolean consumed = false;
155-
if (arGL2Present)
152+
if (arGL2Present) {
156153
consumed = zebraMouseWheel(getGLCanvasHandle(), e.getWheelRotation());
157-
if (consumed == true)
154+
}
155+
if (consumed == true) {
158156
e.consume();
159-
else
157+
} else {
160158
super.mouseWheelMoved(e);
159+
}
161160
}
162161

163-
private long getGLCanvasHandle()
164-
{
162+
private long getGLCanvasHandle() {
165163
/**
166-
* Returns the win32 HWND handle of the GLCanvas component by calling native
167-
* C++ code in arGL2Integrator.
164+
* Returns the win32 HWND handle of the GLCanvas component by calling native C++ code in arGL2Integrator.
168165
*/
169-
if (hwnd == 0)
170-
{
166+
if (hwnd == 0) {
171167
WorldWindow ww = this.getWorldWindow();
172-
if (ww != null)
173-
{
168+
if (ww != null) {
174169
WorldWindowGLCanvas wwgl = (WorldWindowGLCanvas) ww;
175170
GLCanvas glc = wwgl;
176171
Canvas cv = glc;
@@ -182,60 +177,53 @@ private long getGLCanvasHandle()
182177
return hwnd;
183178
}
184179

185-
private static ZebraInputHandler getInstance(long hwnd)
186-
{
180+
private static ZebraInputHandler getInstance(long hwnd) {
187181
Iterator<ZebraInputHandler> itr = instances.iterator();
188-
while (itr.hasNext())
189-
{
182+
while (itr.hasNext()) {
190183
ZebraInputHandler h = itr.next();
191-
if (h.hwnd == hwnd)
184+
if (h.hwnd == hwnd) {
192185
return h;
186+
}
193187
}
194188

195189
return null;
196190
}
197191

198192
// Java static methods executed by arGL2Integrator.dll via JNI
199-
200-
public static void forceRepaint(long hwnd)
201-
{
202-
/** Force the instance of the ZebraViewInputHandler class to redraw it's associated OpenGL window. */
193+
public static void forceRepaint(long hwnd) {
194+
/**
195+
* Force the instance of the ZebraViewInputHandler class to redraw it's associated OpenGL window.
196+
*/
203197
ZebraInputHandler h = getInstance(hwnd);
204-
if (h != null)
205-
{
206-
h.SetRefresh(true);
207-
//h.refresh = true;
198+
if (h != null) {
199+
h.SetRefresh(true);
200+
//h.refresh = true;
208201
}
209202
}
210203

211-
public static double[] getModelviewMatrix(long hwnd)
212-
{
204+
public static double[] getModelviewMatrix(long hwnd) {
213205
double[] matrix = new double[16];
214206

215207
ZebraInputHandler h = getInstance(hwnd);
216-
if (h != null)
217-
{
208+
if (h != null) {
218209
h.getWorldWindow().getView().getModelviewMatrix().toArray(matrix, 0, false);
219210
}
220211

221212
return matrix;
222213
}
223214

224-
public static double[] getProjectionMatrix(long hwnd)
225-
{
215+
public static double[] getProjectionMatrix(long hwnd) {
226216
double[] matrix = new double[16];
227217

228218
ZebraInputHandler h = getInstance(hwnd);
229-
if (h != null)
230-
{
219+
if (h != null) {
231220
h.getWorldWindow().getView().getProjectionMatrix().toArray(matrix, 0, false);
232221
}
233222

234223
return matrix;
235224
}
236225

237226
// Methods imported from the zebra's arGL2Integrator.dll library and executed by java
238-
239227
public native boolean zebraKeyPressed(long hwnd, int keyCode);
240228

241229
public native boolean zebraKeyReleased(long hwnd, int keyCode);

src/config/DataFileStore.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?xml version="1.0"?>
22
<!--
3-
~ Copyright (C) 2012 United States Government as represented by the Administrator of the
4-
~ National Aeronautics and Space Administration.
5-
~ All Rights Reserved.
6-
-->
3+
~ Copyright (C) 2012 United States Government as represented by the Administrator of the
4+
~ National Aeronautics and Space Administration.
5+
~ All Rights Reserved.
6+
-->
77

88
<!--
9-
~ WorldWind data-file store configuration
10-
~
11-
~ $Id: DataFileStore.xml 1171 2013-02-11 21:45:02Z dcollins $
12-
-->
9+
~ WorldWind data-file store configuration
10+
~
11+
~ $Id: DataFileStore.xml 1171 2013-02-11 21:45:02Z dcollins $
12+
-->
1313
<dataFileStore>
1414
<readLocations>
1515
<!-- The read locations are searched, in the given order, when WorldWind needs a data or image file. -->

src/config/Earth/AlaskaFAASectionals.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
~ Copyright (C) 2012 United States Government as represented by the Administrator of the
4-
~ National Aeronautics and Space Administration.
5-
~ All Rights Reserved.
6-
-->
3+
~ Copyright (C) 2012 United States Government as represented by the Administrator of the
4+
~ National Aeronautics and Space Administration.
5+
~ All Rights Reserved.
6+
-->
77

88
<!--$Id: AlaskaFAASectionals.xml 2048 2014-06-09 16:39:45Z tgaskins $-->
99
<Layer version="1" layerType="TiledImageLayer">

src/config/Earth/AsterWCS.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
~ Copyright (C) 2012 United States Government as represented by the Administrator of the
4-
~ National Aeronautics and Space Administration.
5-
~ All Rights Reserved.
6-
-->
3+
~ Copyright (C) 2012 United States Government as represented by the Administrator of the
4+
~ National Aeronautics and Space Administration.
5+
~ All Rights Reserved.
6+
-->
77

88
<!--$Id: AsterWCS.xml 2089 2014-06-24 21:39:21Z tgaskins $-->
99
<ElevationModel version="1" modelType="Compound">

src/config/Earth/BMNG256.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
~ Copyright (C) 2012 United States Government as represented by the Administrator of the
4-
~ National Aeronautics and Space Administration.
5-
~ All Rights Reserved.
6-
-->
3+
~ Copyright (C) 2012 United States Government as represented by the Administrator of the
4+
~ National Aeronautics and Space Administration.
5+
~ All Rights Reserved.
6+
-->
77

88
<!--Blue Marble Next generation 2004 + Bathymetry imagery, using the default month (May).-->
99
<!--$Id: BMNG256.xml 1865 2014-03-13 21:00:05Z tgaskins $-->

0 commit comments

Comments
 (0)