Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
Satellite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christopher Reis
Satellite
Commits
66a06e44
Commit
66a06e44
authored
Nov 16, 2015
by
Christopher Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added 3D window and buggy tracking
parent
b91373b5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
218 additions
and
30 deletions
+218
-30
satPosition.class
bin/satellite/satPosition.class
+0
-0
Application.java
src/GUI/Application.java
+53
-14
satelliteStatus.java
src/GUI/satelliteStatus.java
+6
-13
view3D.java
src/GUI/view3D.java
+124
-0
TrackerList.java
src/satellite/TrackerList.java
+8
-0
satPosition.java
src/satellite/satPosition.java
+15
-0
tracker.java
src/satellite/tracker.java
+12
-3
No files found.
bin/satellite/satPosition.class
View file @
66a06e44
No preview for this file type
src/GUI/Application.java
View file @
66a06e44
...
@@ -13,6 +13,8 @@ import javax.swing.ImageIcon;
...
@@ -13,6 +13,8 @@ import javax.swing.ImageIcon;
import
javax.swing.JMenuItem
;
import
javax.swing.JMenuItem
;
import
javax.swing.AbstractAction
;
import
javax.swing.AbstractAction
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
javax.swing.Action
;
import
javax.swing.Action
;
import
javax.swing.JTree
;
import
javax.swing.JTree
;
import
javax.swing.tree.DefaultTreeModel
;
import
javax.swing.tree.DefaultTreeModel
;
...
@@ -28,6 +30,11 @@ import java.awt.event.KeyEvent;
...
@@ -28,6 +30,11 @@ import java.awt.event.KeyEvent;
import
java.awt.event.InputEvent
;
import
java.awt.event.InputEvent
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
java.awt.event.MouseEvent
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
javax.swing.JDesktopPane
;
import
javax.swing.JDesktopPane
;
import
javax.swing.JToolBar
;
import
javax.swing.JToolBar
;
import
javax.swing.JProgressBar
;
import
javax.swing.JProgressBar
;
...
@@ -37,19 +44,37 @@ import javax.swing.JTextField;
...
@@ -37,19 +44,37 @@ import javax.swing.JTextField;
public
class
Application
{
public
class
Application
{
private
JFrame
frmSatelliteTracker
;
private
JFrame
frmSatelliteTracker
;
private
final
Action
action
=
new
SwingAction
();
static
TrackerList
trackList
=
new
TrackerList
();
TrackerList
trackList
=
new
TrackerList
();
static
SatelliteDB
satellites
=
new
SatelliteDB
(
"SatelliteDB"
);
SatelliteDB
satellites
=
new
SatelliteDB
(
"SatelliteDB"
);
static
view3D
threeDview
=
new
view3D
();
static
ActionListener
updateTracks
=
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
evt
)
{
List
<
satPosition
>
pos
=
TrackerList
.
getTracks
();
threeDview
.
updateTracks
(
pos
);
System
.
out
.
println
(
"update"
);
}
};
static
ActionListener
addtrack
=
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
evt
)
{
threeDview
.
addSatellite
(
TrackerList
.
getTracks
());
}
};
/**
/**
* Launch the application.
* Launch the application.
* @throws InterruptedException
* @throws InvocationTargetException
*/
*/
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
throws
InvocationTargetException
,
InterruptedException
{
EventQueue
.
invokeLater
(
new
Runnable
()
{
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
public
void
run
()
{
try
{
try
{
Application
window
=
new
Application
();
Application
window
=
new
Application
();
window
.
frmSatelliteTracker
.
setVisible
(
true
);
window
.
frmSatelliteTracker
.
setVisible
(
true
);
new
javax
.
swing
.
Timer
(
500
,
updateTracks
).
start
();
new
javax
.
swing
.
Timer
(
500
,
addtrack
).
start
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -62,6 +87,18 @@ public class Application {
...
@@ -62,6 +87,18 @@ public class Application {
*/
*/
public
Application
()
{
public
Application
()
{
initialize
();
initialize
();
// EventQueue.invokeLater(new Runnable() {
// public void run() {
// try {
// while(true){
// System.out.println(new Date());
// Thread.sleep(500);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// });
}
}
/**
/**
...
@@ -80,15 +117,26 @@ public class Application {
...
@@ -80,15 +117,26 @@ public class Application {
satTree
.
setClosable
(
true
);
satTree
.
setClosable
(
true
);
satTree
.
setDefaultCloseOperation
(
JFrame
.
HIDE_ON_CLOSE
);
satTree
.
setDefaultCloseOperation
(
JFrame
.
HIDE_ON_CLOSE
);
satTree
.
setResizable
(
true
);
satTree
.
setResizable
(
true
);
satTree
.
setBounds
(
10
,
52
,
867
,
495
);
satTree
.
setVisible
(
false
);
satTree
.
setBounds
(
448
,
177
,
867
,
495
);
desktopPane
.
add
(
satTree
);
desktopPane
.
add
(
satTree
);
satelliteStatus
satStatus
=
new
satelliteStatus
();
satelliteStatus
satStatus
=
new
satelliteStatus
();
satStatus
.
setLocation
(
32
,
86
);
satStatus
.
setClosable
(
true
);
satStatus
.
setClosable
(
true
);
satStatus
.
setDefaultCloseOperation
(
JFrame
.
HIDE_ON_CLOSE
);
satStatus
.
setDefaultCloseOperation
(
JFrame
.
HIDE_ON_CLOSE
);
satStatus
.
setResizable
(
true
);
satStatus
.
setResizable
(
true
);
satStatus
.
setVisible
(
false
);
desktopPane
.
add
(
satStatus
);
desktopPane
.
add
(
satStatus
);
threeDview
=
new
view3D
();
threeDview
.
setClosable
(
true
);
threeDview
.
setDefaultCloseOperation
(
JFrame
.
HIDE_ON_CLOSE
);
threeDview
.
setResizable
(
true
);
threeDview
.
setVisible
(
true
);
threeDview
.
setBounds
(
300
,
20
,
500
,
500
);
desktopPane
.
add
(
threeDview
);
JMenuBar
menuBar
=
new
JMenuBar
();
JMenuBar
menuBar
=
new
JMenuBar
();
frmSatelliteTracker
.
setJMenuBar
(
menuBar
);
frmSatelliteTracker
.
setJMenuBar
(
menuBar
);
...
@@ -209,13 +257,4 @@ public class Application {
...
@@ -209,13 +257,4 @@ public class Application {
}
}
private
class
SwingAction
extends
AbstractAction
{
public
SwingAction
()
{
putValue
(
NAME
,
"SwingAction"
);
putValue
(
SHORT_DESCRIPTION
,
"Some short description"
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
}
}
}
}
src/GUI/satelliteStatus.java
View file @
66a06e44
...
@@ -25,6 +25,7 @@ import javax.swing.JPanel;
...
@@ -25,6 +25,7 @@ import javax.swing.JPanel;
import
javax.swing.JButton
;
import
javax.swing.JButton
;
import
java.awt.GridLayout
;
import
java.awt.GridLayout
;
@SuppressWarnings
(
"serial"
)
public
class
satelliteStatus
extends
JInternalFrame
{
public
class
satelliteStatus
extends
JInternalFrame
{
SatelliteTrack
curSat
=
null
;
SatelliteTrack
curSat
=
null
;
...
@@ -74,29 +75,21 @@ public class satelliteStatus extends JInternalFrame {
...
@@ -74,29 +75,21 @@ public class satelliteStatus extends JInternalFrame {
panel
.
add
(
btnStopTracking
);
panel
.
add
(
btnStopTracking
);
JLabel
lblLatitude
=
new
JLabel
(
"Latitude"
);
JLabel
lblLatitude
=
new
JLabel
(
"Latitude"
);
lblLatitude
.
setBounds
(
35
,
21
,
165
,
31
);
lblLatitude
.
setBounds
(
35
,
94
,
92
,
31
);
panel
.
add
(
lblLatitude
);
panel
.
add
(
lblLatitude
);
JLabel
lblLongitude
=
new
JLabel
(
"Longitude"
);
JLabel
lblLongitude
=
new
JLabel
(
"Longitude"
);
lblLongitude
.
setBounds
(
35
,
73
,
92
,
26
);
lblLongitude
.
setBounds
(
35
,
144
,
92
,
26
);
panel
.
add
(
lblLongitude
);
panel
.
add
(
lblLongitude
);
JLabel
lblAltitude
=
new
JLabel
(
"Altitude"
);
JLabel
lblAltitude
=
new
JLabel
(
"Altitude"
);
lblAltitude
.
setBounds
(
35
,
1
20
,
92
,
26
);
lblAltitude
.
setBounds
(
35
,
1
91
,
92
,
26
);
panel
.
add
(
lblAltitude
);
panel
.
add
(
lblAltitude
);
JLabel
lblRange
=
new
JLabel
(
"Range"
);
JLabel
lblRange
=
new
JLabel
(
"Range"
);
lblRange
.
setBounds
(
35
,
17
2
,
92
,
26
);
lblRange
.
setBounds
(
35
,
23
2
,
92
,
26
);
panel
.
add
(
lblRange
);
panel
.
add
(
lblRange
);
JLabel
lblLat
=
new
JLabel
(
"Lat"
);
lblLat
.
setBounds
(
164
,
23
,
92
,
26
);
panel
.
add
(
lblLat
);
JLabel
lblLong
=
new
JLabel
(
"Long"
);
lblLong
.
setBounds
(
164
,
73
,
92
,
26
);
panel
.
add
(
lblLong
);
//Where the tree is initialized:
//Where the tree is initialized:
tree
.
getSelectionModel
().
setSelectionMode
(
TreeSelectionModel
.
SINGLE_TREE_SELECTION
);
tree
.
getSelectionModel
().
setSelectionMode
(
TreeSelectionModel
.
SINGLE_TREE_SELECTION
);
...
...
src/GUI/view3D.java
0 → 100644
View file @
66a06e44
package
GUI
;
import
java.awt.Color
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.swing.JInternalFrame
;
import
gov.nasa.worldwind.BasicModel
;
import
gov.nasa.worldwind.WorldWind
;
import
gov.nasa.worldwind.avlist.AVKey
;
import
gov.nasa.worldwind.awt.WorldWindowGLCanvas
;
import
gov.nasa.worldwind.geom.Position
;
import
gov.nasa.worldwind.layers.Layer
;
import
gov.nasa.worldwind.layers.LayerList
;
import
gov.nasa.worldwind.layers.RenderableLayer
;
import
gov.nasa.worldwind.render.Offset
;
import
gov.nasa.worldwind.render.PointPlacemark
;
import
gov.nasa.worldwind.render.PointPlacemarkAttributes
;
import
gov.nasa.worldwind.render.Renderable
;
import
satellite.satPosition
;
public
class
view3D
extends
JInternalFrame
{
private
List
<
satPosition
>
trackList
=
new
ArrayList
<
satPosition
>();
WorldWindowGLCanvas
wwd
;
public
view3D
()
{
wwd
=
new
WorldWindowGLCanvas
();
wwd
.
setPreferredSize
(
new
java
.
awt
.
Dimension
(
500
,
500
));
this
.
getContentPane
().
add
(
wwd
,
java
.
awt
.
BorderLayout
.
CENTER
);
wwd
.
setModel
(
new
BasicModel
());
//Add Layers
}
public
void
updateTracks
(
List
<
satPosition
>
positions
){
LayerList
layers
=
wwd
.
getModel
().
getLayers
();
//wwd.getModel().getLayers().getLayerByName("Satellite");
for
(
int
i
=
0
;
i
<
layers
.
size
();
i
++){
if
(
layers
.
get
(
i
).
getName
().
equals
(
"Satellite"
)){
layers
.
get
(
i
).
dispose
();
for
(
int
j
=
0
;
j
<
positions
.
size
();
j
++){
PointPlacemark
pp
=
new
PointPlacemark
(
Position
.
fromDegrees
(
positions
.
get
(
j
).
getLat
(),
positions
.
get
(
j
).
getLon
()
,
positions
.
get
(
j
).
getAlt
()));
pp
.
setLabelText
(
positions
.
get
(
j
).
getName
());
pp
.
setValue
(
AVKey
.
DISPLAY_NAME
,
"Clamp to ground, Label, Semi-transparent, Audio icon"
);
pp
.
setLineEnabled
(
false
);
pp
.
setAltitudeMode
(
WorldWind
.
CLAMP_TO_GROUND
);
PointPlacemarkAttributes
attrs
=
new
PointPlacemarkAttributes
();
attrs
.
setImageAddress
(
"gov/nasa/worldwindx/examples/images/audioicon-64.png"
);
attrs
.
setImageColor
(
new
Color
(
1
f
,
1
f
,
1
f
,
0.6f
));
attrs
.
setScale
(
0.6
);
// attrs.setImageOffset(new Offset(19d, 8d, AVKey.PIXELS, AVKey.PIXELS));
attrs
.
setLabelOffset
(
new
Offset
(
0.9d
,
0.6d
,
AVKey
.
FRACTION
,
AVKey
.
FRACTION
));
pp
.
setAttributes
(
attrs
);
((
RenderableLayer
)
layers
.
get
(
i
)).
addRenderable
(
pp
);
}
wwd
.
getModel
().
setLayers
(
layers
);
wwd
.
redraw
();
return
;
}
for
(
int
j
=
0
;
j
<
positions
.
size
();
j
++){
PointPlacemark
pp
=
new
PointPlacemark
(
Position
.
fromDegrees
(
positions
.
get
(
j
).
getLat
(),
positions
.
get
(
j
).
getLon
()
,
positions
.
get
(
j
).
getAlt
()));
pp
.
setLabelText
(
positions
.
get
(
j
).
getName
());
pp
.
setValue
(
AVKey
.
DISPLAY_NAME
,
"Clamp to ground, Label, Semi-transparent, Audio icon"
);
pp
.
setLineEnabled
(
false
);
pp
.
setAltitudeMode
(
WorldWind
.
CLAMP_TO_GROUND
);
PointPlacemarkAttributes
attrs
=
new
PointPlacemarkAttributes
();
attrs
.
setImageAddress
(
"gov/nasa/worldwindx/examples/images/audioicon-64.png"
);
attrs
.
setImageColor
(
new
Color
(
1
f
,
1
f
,
1
f
,
0.6f
));
attrs
.
setScale
(
0.6
);
// attrs.setImageOffset(new Offset(19d, 8d, AVKey.PIXELS, AVKey.PIXELS));
attrs
.
setLabelOffset
(
new
Offset
(
0.9d
,
0.6d
,
AVKey
.
FRACTION
,
AVKey
.
FRACTION
));
pp
.
setAttributes
(
attrs
);
((
RenderableLayer
)
layers
.
get
(
i
)).
addRenderable
(
pp
);
}
wwd
.
getModel
().
setLayers
(
layers
);
wwd
.
redraw
();
return
;
}
}
public
void
addTrack
(
String
name
,
Double
lat
,
Double
lon
){
RenderableLayer
layer
=
new
RenderableLayer
();
Iterable
<
Renderable
>
iter
=
layer
.
getRenderables
();
for
(
Renderable
rend
:
iter
){
if
(
rend
instanceof
PointPlacemark
){
PointPlacemark
delp
=
(
PointPlacemark
)
rend
;
if
(
delp
.
getLabelText
().
equals
(
name
)){
delp
.
setPosition
(
Position
.
fromDegrees
(
lat
,
lon
));
return
;
}
}
}
PointPlacemark
pp
=
new
PointPlacemark
(
Position
.
fromDegrees
(
lat
,
lon
,
1
e4
));
pp
.
setValue
(
AVKey
.
DISPLAY_NAME
,
"Clamp to ground, Audio icon, Heading -45, Globe relative"
);
pp
.
setLabelText
(
name
);
pp
.
setLineEnabled
(
false
);
pp
.
setAltitudeMode
(
WorldWind
.
CLAMP_TO_GROUND
);
PointPlacemarkAttributes
attrs
=
new
PointPlacemarkAttributes
();
attrs
.
setImageAddress
(
"gov/nasa/worldwindx/examples/images/audioicon-64.png"
);
attrs
.
setHeading
(-
45
d
);
attrs
.
setHeadingReference
(
AVKey
.
RELATIVE_TO_GLOBE
);
attrs
.
setScale
(
0.6
);
// attrs.setImageOffset(new Offset(0.5, 0.5, AVKey.FRACTION, AVKey.FRACTION));
attrs
.
setImageOffset
(
new
Offset
(
19
d
,
8
d
,
AVKey
.
PIXELS
,
AVKey
.
PIXELS
));
attrs
.
setLabelColor
(
"ffffffff"
);
attrs
.
setLabelOffset
(
new
Offset
(
0.9d
,
0.6d
,
AVKey
.
FRACTION
,
AVKey
.
FRACTION
));
pp
.
setAttributes
(
attrs
);
layer
.
addRenderable
(
pp
);
// Add the layer to the model.
wwd
.
getModel
().
getLayers
().
add
(
layer
);
// Update layer panel
wwd
.
redraw
();
}
public
void
addSatellite
(
List
<
satPosition
>
positions
){
for
(
int
i
=
0
;
i
<
positions
.
size
();
i
++){
addTrack
(
positions
.
get
(
i
).
getName
(),
positions
.
get
(
i
).
getLat
(),
positions
.
get
(
i
).
getLon
());
}
}
}
src/satellite/TrackerList.java
View file @
66a06e44
...
@@ -27,6 +27,14 @@ public class TrackerList {
...
@@ -27,6 +27,14 @@ public class TrackerList {
return
threadList
.
get
(
satNum
).
sat
.
getPosition
();
return
threadList
.
get
(
satNum
).
sat
.
getPosition
();
}
}
public
static
List
<
satPosition
>
getTracks
(){
List
<
satPosition
>
positions
=
new
ArrayList
<
satPosition
>();
for
(
int
i
=
0
;
i
<
threadList
.
size
();
i
++){
positions
.
add
(
threadList
.
get
(
i
).
getPos
());
}
return
positions
;
}
private
static
int
searchThread
(
String
sat
){
private
static
int
searchThread
(
String
sat
){
for
(
int
i
=
0
;
i
<
threadList
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
threadList
.
size
();
i
++){
if
(
sat
.
trim
().
equals
(
threadList
.
get
(
i
).
name
)){
if
(
sat
.
trim
().
equals
(
threadList
.
get
(
i
).
name
)){
...
...
src/satellite/satPosition.java
View file @
66a06e44
...
@@ -8,15 +8,30 @@ public class satPosition{
...
@@ -8,15 +8,30 @@ public class satPosition{
private
final
double
lon
;
private
final
double
lon
;
private
final
double
alt
;
private
final
double
alt
;
private
final
Date
time
;
private
final
Date
time
;
private
final
String
name
;
public
satPosition
(
double
lat
,
double
lon
,
double
alt
,
Date
time
)
{
public
satPosition
(
double
lat
,
double
lon
,
double
alt
,
Date
time
)
{
super
();
super
();
this
.
lat
=
lat
;
this
.
lat
=
lat
;
this
.
lon
=
lon
;
this
.
lon
=
lon
;
this
.
alt
=
alt
;
this
.
alt
=
alt
;
this
.
name
=
"blank"
;
this
.
time
=
time
;
this
.
time
=
time
;
}
}
public
satPosition
(
double
lat
,
double
lon
,
double
alt
,
String
name
)
{
super
();
this
.
lat
=
lat
;
this
.
lon
=
lon
;
this
.
alt
=
alt
;
this
.
name
=
name
;
this
.
time
=
new
Date
();
}
public
String
getName
(){
return
name
;
}
public
double
getLat
()
{
public
double
getLat
()
{
return
lat
/
(
Math
.
PI
*
2.0
)
*
360
;
return
lat
/
(
Math
.
PI
*
2.0
)
*
360
;
}
}
...
...
src/satellite/tracker.java
View file @
66a06e44
...
@@ -3,12 +3,16 @@ package satellite;
...
@@ -3,12 +3,16 @@ package satellite;
public
class
tracker
extends
Thread
{
public
class
tracker
extends
Thread
{
public
tracker
(
SatelliteTrack
satellite
){
public
tracker
(
SatelliteTrack
satellite
){
sat
=
satellite
;
this
.
sat
=
satellite
;
name
=
satellite
.
getTLE
().
getName
();
this
.
name
=
satellite
.
getTLE
().
getName
();
this
.
image
=
satellite
.
getImage
();
this
.
color
=
satellite
.
getTrackColor
();
}
}
public
String
name
;
public
String
name
;
public
SatelliteTrack
sat
;
public
SatelliteTrack
sat
;
String
image
;
String
color
;
int
seconds
=
0
;
int
seconds
=
0
;
public
void
run
(){
public
void
run
(){
...
@@ -24,4 +28,9 @@ public class tracker extends Thread{
...
@@ -24,4 +28,9 @@ public class tracker extends Thread{
}
}
}
}
}
}
public
satPosition
getPos
(){
satPosition
satPos
=
new
satPosition
(
sat
.
getPosition
().
getLat
(),
sat
.
getPosition
().
getLon
(),
sat
.
getPosition
().
getAlt
(),
sat
.
getTLE
().
getName
());
return
satPos
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment