Skip to content

Commit

Permalink
- Added globe imagery to WorldWindPanel for high altitude navigation
Browse files Browse the repository at this point in the history
- WorldWindPanel now allows a custom list of layers to be passed in
- EnvironmentManagerF map now shows place names
  • Loading branch information
nbbrooks committed May 27, 2014
1 parent 624ab4f commit 4037f8c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
19 changes: 14 additions & 5 deletions src/crw/EnvironmentManagerF.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import javax.swing.filechooser.FileNameExtensionFilter;
import sami.environment.EnvironmentProperties;
import sami.path.Location;
import sami.ui.MissionMonitor;
import static sami.ui.MissionMonitor.LAST_EPF_FILE;
import static sami.ui.MissionMonitor.LAST_EPF_FOLDER;

Expand All @@ -51,13 +52,18 @@ public class EnvironmentManagerF extends JFrame {
WorldWindPanel wwPanel;

public EnvironmentManagerF() {
super("ObstacleManagerF");
setTitle("EnvironmentManagerF");
super("EnvironmentManagerF");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());

// Add map
ArrayList<String> layerNames = new ArrayList<String>();
layerNames.add("Bing Imagery");
layerNames.add("Blue Marble (WMS) 2004");
layerNames.add("Scale bar");
layerNames.add("Place Names");
wwPanel = new WorldWindPanel();
wwPanel.createMap();
wwPanel.createMap(layerNames);
getContentPane().add(wwPanel.component, BorderLayout.CENTER);
// Add widgets
List<SelectGeometryWidget.SelectMode> modes = Arrays.asList(SelectGeometryWidget.SelectMode.AREA, SelectGeometryWidget.SelectMode.NONE, SelectGeometryWidget.SelectMode.CLEAR);
Expand Down Expand Up @@ -115,7 +121,6 @@ public void actionPerformed(ActionEvent ae) {
}

pack();
setVisible(true);
}

public void applyObstacleList(ArrayList<ArrayList<Location>> obstacleList) {
Expand Down Expand Up @@ -270,6 +275,10 @@ public boolean loadEpf(File epfFile) {
}

public static void main(String[] args) {
EnvironmentManagerF mf = new EnvironmentManagerF();
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new EnvironmentManagerF().setVisible(true);
}
});
}
}
17 changes: 13 additions & 4 deletions src/crw/ui/component/WorldWindPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ public WorldWindPanel() {
}

public void createMap() {
createMap(400, 300);
createMap(400, 300, null);
}

public void createMap(int width, int height) {
public void createMap(ArrayList<String> layerNames) {
createMap(400, 300, layerNames);
}

public void createMap(int width, int height, ArrayList<String> layerNames) {
widgetList = new Vector<WorldWindWidgetInt>();
// Use flat Earth
Configuration.setValue(AVKey.GLOBE_CLASS_NAME, EarthFlat.class.getName());
Expand All @@ -114,9 +118,14 @@ public void createMap(int width, int height) {
wwCanvas.setModel(new BasicModel());

// Virtual Earth
if(layerNames == null) {
layerNames = new ArrayList<String>();
layerNames.add("Bing Imagery");
layerNames.add("Blue Marble (WMS) 2004");
layerNames.add("Scale bar");
}
for (Layer layer : wwCanvas.getModel().getLayers()) {
if (layer.getName().equals("Bing Imagery")
|| layer.getName().equals("Scale bar")) {
if(layerNames.contains(layer.getName())) {
layer.setEnabled(true);
} else {
layer.setEnabled(false);
Expand Down

0 comments on commit 4037f8c

Please sign in to comment.