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
b1c013d1
Commit
b1c013d1
authored
Nov 02, 2015
by
Christopher Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added SatelliteTrack to tracker thread and start stop functionality to sat status page
parent
658471f8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
14 deletions
+119
-14
.gitignore
bin/.gitignore
+1
-1
Application.java
src/GUI/Application.java
+13
-0
satelliteStatus.java
src/GUI/satelliteStatus.java
+97
-11
satelliteTree.java
src/GUI/satelliteTree.java
+2
-1
trackerThread.java
src/satellite/trackerThread.java
+6
-1
No files found.
bin/.gitignore
View file @
b1c013d1
/GUI/
/satellite/
/GUI/
src/GUI/Application.java
View file @
b1c013d1
...
...
@@ -82,6 +82,12 @@ public class Application {
satTree
.
setBounds
(
10
,
52
,
867
,
495
);
desktopPane
.
add
(
satTree
);
satelliteStatus
satStatus
=
new
satelliteStatus
();
satStatus
.
setClosable
(
true
);
satStatus
.
setDefaultCloseOperation
(
JFrame
.
HIDE_ON_CLOSE
);
satStatus
.
setResizable
(
true
);
desktopPane
.
add
(
satStatus
);
JMenuBar
menuBar
=
new
JMenuBar
();
frmSatelliteTracker
.
setJMenuBar
(
menuBar
);
...
...
@@ -160,6 +166,13 @@ public class Application {
mnWindows
.
add
(
mntmFuturePasses
);
JMenuItem
mntmSatelliteInfo
=
new
JMenuItem
(
"Satellite Info"
);
mntmSatelliteInfo
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mousePressed
(
MouseEvent
arg0
)
{
satStatus
.
setVisible
(
true
);
satStatus
.
updateTree
(
satellites
);
}
});
mnWindows
.
add
(
mntmSatelliteInfo
);
JMenuItem
mntmSatelliteTree
=
new
JMenuItem
(
"Satellite Tree"
);
...
...
src/GUI/satelliteStatus.java
View file @
b1c013d1
package
GUI
;
import
java.awt.BorderLayout
;
import
java.awt.EventQueue
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
javax.swing.JDesktopPane
;
import
javax.swing.JInternalFrame
;
import
com.jgoodies.forms.layout.FormLayout
;
import
com.jgoodies.forms.layout.ColumnSpec
;
import
com.jgoodies.forms.layout.RowSpec
;
import
satellite.SatelliteDB
;
import
satellite.SatelliteTrack
;
import
satellite.trackerThread
;
import
com.jgoodies.forms.layout.FormSpecs
;
import
javax.swing.JLabel
;
import
javax.swing.JScrollPane
;
import
javax.swing.JTree
;
import
javax.swing.event.TreeSelectionEvent
;
import
javax.swing.event.TreeSelectionListener
;
import
javax.swing.tree.DefaultMutableTreeNode
;
import
javax.swing.tree.TreeSelectionModel
;
import
javax.swing.JPanel
;
import
javax.swing.JButton
;
public
class
satelliteStatus
extends
JInternalFrame
{
SatelliteTrack
curSat
=
null
;
DefaultMutableTreeNode
root
=
new
DefaultMutableTreeNode
(
"Database"
);
JTree
tree
=
new
JTree
(
root
);
/**
* Create the frame.
*/
public
satelliteStatus
()
{
setBounds
(
100
,
100
,
451
,
576
);
getContentPane
().
setLayout
(
new
FormLayout
(
new
ColumnSpec
[]
{
FormSpecs
.
RELATED_GAP_COLSPEC
,
FormSpecs
.
DEFAULT_COLSPEC
,
FormSpecs
.
RELATED_GAP_COLSPEC
,
FormSpecs
.
DEFAULT_COLSPEC
,},
new
RowSpec
[]
{
FormSpecs
.
RELATED_GAP_ROWSPEC
,
FormSpecs
.
DEFAULT_ROWSPEC
,
FormSpecs
.
RELATED_GAP_ROWSPEC
,
FormSpecs
.
DEFAULT_ROWSPEC
,}));
setBounds
(
100
,
100
,
740
,
530
);
JDesktopPane
desktopPane
=
new
JDesktopPane
();
getContentPane
().
add
(
desktopPane
,
BorderLayout
.
CENTER
);
JScrollPane
treescroll
=
new
JScrollPane
(
tree
);
treescroll
.
setBounds
(
0
,
0
,
254
,
481
);
desktopPane
.
add
(
treescroll
);
JPanel
panel
=
new
JPanel
();
panel
.
setBounds
(
254
,
0
,
470
,
481
);
desktopPane
.
add
(
panel
);
JButton
btnStartTracking
=
new
JButton
(
"Start Tracking"
);
btnStartTracking
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mousePressed
(
MouseEvent
arg0
)
{
trackerThread
.
setSatellite
(
curSat
);
(
new
Thread
(
new
trackerThread
())).
start
();
}
});
panel
.
add
(
btnStartTracking
);
//Where the tree is initialized:
tree
.
getSelectionModel
().
setSelectionMode
(
TreeSelectionModel
.
SINGLE_TREE_SELECTION
);
//Listen for when the selection changes.
tree
.
addTreeSelectionListener
(
new
TreeSelectionListener
()
{
public
void
valueChanged
(
TreeSelectionEvent
e
)
{
DefaultMutableTreeNode
node
=
(
DefaultMutableTreeNode
)
tree
.
getLastSelectedPathComponent
();
/* if nothing is selected */
if
(
node
==
null
)
return
;
/* retrieve the node that was selected */
Object
nodeInfo
=
node
.
getUserObject
();
/* React to the node selection. */
if
(
node
.
isLeaf
())
{
curSat
=
SatelliteDB
.
sat
(
SatelliteDB
.
getSatIndex
((
String
)
nodeInfo
));
trackerThread
.
setSatellite
(
curSat
);
System
.
out
.
println
(
curSat
.
getTLE
().
getName
());
}
else
{
System
.
out
.
println
(
"Not Leaf"
);
}
}
});
}
public
void
updateTree
(
SatelliteDB
satellites
){
//Iterate through sat database
for
(
int
i
=
0
;
i
<
satellites
.
getSize
();
i
++){
boolean
b_set
=
false
;
//pull constellation from satellite
String
constillation
=
satellites
.
sat
(
i
).
getConstillation
();
//pull nodes from Jtree
int
count
=
root
.
getChildCount
();
System
.
out
.
println
(
count
);
for
(
int
j
=
0
;
j
<
count
;
j
++){
System
.
out
.
println
(
root
.
getChildCount
());
DefaultMutableTreeNode
node
=
(
DefaultMutableTreeNode
)
root
.
getChildAt
(
j
);
if
(
node
.
toString
().
equalsIgnoreCase
(
constillation
.
trim
())){
node
.
add
(
new
DefaultMutableTreeNode
(
satellites
.
sat
(
i
).
getTLE
().
getName
()));
System
.
out
.
println
(
"added to existing"
);
b_set
=
true
;
}
}
if
(!
b_set
)
{
DefaultMutableTreeNode
newNode
=
new
DefaultMutableTreeNode
(
constillation
);
newNode
.
add
(
new
DefaultMutableTreeNode
(
satellites
.
sat
(
i
).
getTLE
().
getName
()));
root
.
add
(
newNode
);
}
}
}
}
src/GUI/satelliteTree.java
View file @
b1c013d1
...
...
@@ -94,7 +94,8 @@ public class satelliteTree extends JInternalFrame {
BufferedImage
img
=
null
;
try
{
img
=
ImageIO
.
read
(
new
File
(
"D:\\MyDocuments\\GitHub\\Satellite\\satellite.png"
));
img
=
ImageIO
.
read
(
new
File
(
"C:\\Users\\Christopher\\Documents\\GitHub\\Satellite\\satellite.png"
));
//D:\\MyDocuments\\GitHub\\Satellite\\satellite.png
//C:\\Users\\Christopher\\Documents\\GitHub\\Satellite\\satellite.png
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
src/satellite/trackerThread.java
View file @
b1c013d1
...
...
@@ -4,10 +4,11 @@ package satellite;
public
class
trackerThread
implements
Runnable
{
static
SatelliteTrack
sat
;
int
seconds
=
0
;
public
void
run
(){
while
(
true
){
System
.
out
.
println
(
"
Running for: "
+
seconds
);
System
.
out
.
println
(
"
Tracking "
+
sat
.
getTLE
().
getName
()
+
" for: "
+
seconds
+
" seconds"
);
seconds
++;
try
{
...
...
@@ -17,5 +18,9 @@ public class trackerThread implements Runnable{
}
}
}
public
static
void
setSatellite
(
SatelliteTrack
satellite
){
sat
=
satellite
;
}
}
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