/*@http://www.codefans.net
* MapView.java
*/
package mapapp;
import java.awt.Color;
import java.awt.Graphics2D;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import org.jdesktop.swingx.JXMapViewer;
import org.jdesktop.swingx.mapviewer.GeoPosition;
import org.jdesktop.swingx.mapviewer.Waypoint;
import org.jdesktop.swingx.mapviewer.WaypointPainter;
import org.jdesktop.swingx.mapviewer.WaypointRenderer;
import org.jdesktop.swingx.mapviewer.wms.WMSService;
import org.jdesktop.swingx.mapviewer.wms.WMSTileFactory;
/**
* The application's main frame.
*/
public class MapView extends FrameView {
public MapView(SingleFrameApplication app) {
super(app);
initComponents();
//WMSService wms = new WMSService();
//wms.setBaseUrl("http://132.156.10.87/cgi-bin/atlaswms_en?REQUEST=GetCapabilities");
// wms.setLayer();
//jXMapKit1.setTileFactory(new WMSTileFactory(wms));
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
messageTimer = new Timer(messageTimeout, new ActionListener() {
public void actionPerformed(ActionEvent e) {
statusMessageLabel.setText("");
}
});
messageTimer.setRepeats(false);
int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
for (int i = 0; i < busyIcons.length; i++) {
busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
}
busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
public void actionPerformed(ActionEvent e) {
busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
}
});
idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
// connecting action tasks to status bar via TaskMonitor
TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if ("started".equals(propertyName)) {
if (!busyIconTimer.isRunning()) {
statusAnimationLabel.setIcon(busyIcons[0]);
busyIconIndex = 0;
busyIconTimer.start();
}
progressBar.setVisible(true);
progressBar.setIndeterminate(true);
} else if ("done".equals(propertyName)) {
busyIconTimer.stop();
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
progressBar.setValue(0);
} else if ("message".equals(propertyName)) {
String text = (String)(evt.getNewValue());
statusMessageLabel.setText((text == null) ? "" : text);
messageTimer.restart();
} else if ("progress".equals(propertyName)) {
int value = (Integer)(evt.getNewValue());
progressBar.setVisible(true);
progressBar.setIndeterminate(false);
progressBar.setValue(value);
}
}
});
}
@Action
public void showAboutBox(ActionEvent e) {
if (aboutBox == null) {
JFrame mainFrame = MapApp.getApplication().getMainFrame();
aboutBox = new MapAboutBox(mainFrame);
aboutBox.setLocationRelativeTo(mainFrame);
}
MapApp.getApplication().show(aboutBox);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
mainPanel = new javax.swing.JPanel();
jXMapKit1 = new org.jdesktop.swingx.JXMapKit();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
javax.swing.JMenu fileMenu = new javax.swing.JMenu();
javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
javax.swing.JMenu helpMenu = new javax.swing.JMenu();
javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
statusPanel = new javax.swing.JPanel();
javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
statusMessageLabel = new javax.swing.JLabel();
statusAnimationLabel = new javax.swing.JLabel();
progressBar = new javax.swing.JProgressBar();
mainPanel.setName("mainPanel"); // NOI18N
jXMapKit1.setDefaultProvider(org.jdesktop.swingx.JXMapKit.DefaultProviders.OpenStreetMaps);
jXMapKit1.setDataProviderCreditShown(true);
jXMapKit1.setName("jXMapKit1"); // NOI18N
javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(mapapp.MapApp.class).getContext().getActionMap(MapView.class, this);
jButton1.setAction(actionMap.get("goChicago")); // NOI18N
jButton1.setName("jButton1"); // NOI18N
jButton2.setAction(actionMap.get("addWaypoint")); // NOI18N
jButton2.setName("jButton2"); // NOI18N
org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(mainPanelLayout.createSequentialGroup()
.add(jButton1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2)
.add(183, 183, 183))
.add(jXMapKit1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup()
.add(jXMapKit1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton1)
.add(jButton2)))
);
menuBar.setName("menuBar"); // NOI18N
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(mapapp.MapApp.class).getContext().getResourceMap(MapView.class);
fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
fileMenu.setName("fileMenu"); // NOI18N
exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
exitMenuItem.setName("exitMenuItem"); // NOI18N
fileMenu.add(exitMenuItem);
me
没有合适的资源?快使用搜索试试~ 我知道了~
基于java的开发源码-用的在线地图浏览模块.zip
共65个文件
png:36个
class:7个
jar:7个
0 下载量 118 浏览量
2024-03-05
19:59:25
上传
评论
收藏 1.74MB ZIP 举报
温馨提示
基于java的开发源码-用的在线地图浏览模块.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于java的开发源码-用的在线地图浏览模块.zip (65个子文件)
codefans.net
MapApp
lib
swingx.jar 3.02MB
swingx-bean.jar 9KB
appframework-1.0.2.jar 318KB
swing-layout-1.0.3.jar 118KB
swing-worker.jar 12KB
swing-worker-1.1.jar 13KB
swingx-ws-2007_10_14.jar 301KB
.classpath 774B
src
mapapp
MapAboutBox.form 10KB
resources
MapAboutBox.properties 292B
MapApp.properties 423B
splash.png 21KB
about.png 8KB
busyicons
busy-icon12.png 4KB
busy-icon8.png 4KB
busy-icon3.png 3KB
busy-icon6.png 3KB
busy-icon2.png 4KB
idle-icon.png 3KB
busy-icon14.png 4KB
busy-icon13.png 4KB
busy-icon9.png 3KB
busy-icon10.png 3KB
busy-icon0.png 4KB
busy-icon5.png 3KB
busy-icon4.png 3KB
busy-icon1.png 4KB
busy-icon7.png 4KB
busy-icon11.png 3KB
MapView.properties 1KB
MapView.java 12KB
MapAboutBox.java 6KB
MapApp.java 1KB
MapView.form 11KB
bin
mapapp
MapView$3.class 2KB
MapAboutBox.class 5KB
MapView$2.class 1007B
MapAboutBox.form 10KB
resources
MapAboutBox.properties 292B
MapApp.properties 423B
splash.png 21KB
about.png 8KB
busyicons
busy-icon12.png 4KB
busy-icon8.png 4KB
busy-icon3.png 3KB
busy-icon6.png 3KB
busy-icon2.png 4KB
idle-icon.png 3KB
busy-icon14.png 4KB
busy-icon13.png 4KB
busy-icon9.png 3KB
busy-icon10.png 3KB
busy-icon0.png 4KB
busy-icon5.png 3KB
busy-icon4.png 3KB
busy-icon1.png 4KB
busy-icon7.png 4KB
busy-icon11.png 3KB
MapView.properties 1KB
MapView.class 10KB
MapApp.class 1KB
MapView.form 11KB
MapView$1.class 823B
MapView$4.class 1008B
.project 382B
共 65 条
- 1
资源评论
毕业课程设计
- 粉丝: 2253
- 资源: 1644
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功