📄 linkpanel.java
字号:
package net.aetherial.gis.cutAndLink;
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import net.aetherial.gis.surface.ItemValue;
import org.w3c.dom.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import net.aetherial.gis.cutAndLink.cut.UniteSection;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class LinkPanel
extends JPanel {
private TempDoc tc =null;
public LinkPanel() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public LinkPanel(TempDoc tc){
this();
this.tc = tc;
}
private void setRunEnable(){
if (ItemValue.IS_JIHUA) {
this.jButton1.setEnabled(false);
}
}
private void jbInit() throws Exception {
this.setRunEnable();
jLabel1.setText("jLabel3");
jLabel1.setBorder(BorderFactory.createEtchedBorder());
jLabel2.setText("与路线:");
jButton1.setText("执行");
jButton1.addActionListener(new LinkPanel_jButton1_actionAdapter(this));
jLabel3.setText("连接");
jLabelNum.setText("航迹点:N个");
jLabel5.setBorder(BorderFactory.createEtchedBorder());
jLabel5.setText("jLabel3");
jLabel6.setText("使用本路线的:");
jLabel7.setText("的");
jLabelName.setText("名称:。。。。。。");
this.setLayout(xYLayout1);
xYLayout1.setWidth(233);
xYLayout1.setHeight(227);
jComboBoxAllTrack.addItemListener(new
LinkPanel_jComboBox_itemAdapter(this));
jComboBoxT1Point.addItemListener(new
LinkPanel_jComboBox_itemAdapter(this));
jComboBoxT2Point.addItemListener(new
LinkPanel_jComboBox_itemAdapter(this));
this.add(jLabelName, new XYConstraints(11, 20, -1, -1));
this.add(jLabelNum, new XYConstraints(11, 50, -1, -1));
this.add(jLabel7, new XYConstraints(11, 140, -1, -1));
this.add(jLabel1, new XYConstraints(12, 105, 168, 2));
this.add(jLabel6, new XYConstraints(11, 80, -1, -1));
this.add(jLabel2, new XYConstraints(11, 110, -1, -1));
this.add(jComboBoxT1Point, new XYConstraints(95, 75, 53, -1));
this.add(jComboBoxT2Point, new XYConstraints(36, 140, 53, -1));
this.add(jLabel3, new XYConstraints(99, 143, -1, -1));
this.add(jComboBoxAllTrack, new XYConstraints(64, 109, -1, -1));
this.add(jLabel5, new XYConstraints(13, 170, 168, 2));
this.add(jButton1, new XYConstraints(46, 180, -1, -1));
}
public void init(){
jLabelName.setText("当前路线名称:"+ItemValue.getTracksName(tc.track));
jLabelNum.setText("包含的GPS采集数据共:"+ItemValue.getTracksNum(tc.track)+"个");
int[] pos = ItemValue.getPosition("track");
if(pos.length>0){
for(int i =0;i<pos.length;i++){
jComboBoxAllTrack.addItem(ItemValue.getTracksName(i)+"["+(i+1)+"]");
}
}
jComboBoxT1Point.addItem("起点");
jComboBoxT1Point.addItem("终点");
jComboBoxT2Point.addItem("起点");
jComboBoxT2Point.addItem("终点");
}
public void setDynamicPanel(DynamicPanel dp){
this.dp = dp;
}
public void drawAnotherTrack(Node node){
}
DynamicPanel dp = null;
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JComboBox jComboBoxAllTrack = new JComboBox();
JButton jButton1 = new JButton();
JLabel jLabel3 = new JLabel();
public JLabel jLabelNum = new JLabel();
JComboBox jComboBoxT1Point = new JComboBox();
JLabel jLabel5 = new JLabel();
JComboBox jComboBoxT2Point = new JComboBox();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabelName = new JLabel();
XYLayout xYLayout1 = new XYLayout();
public void jComboBox_itemStateChanged(ItemEvent e) {
if(e.getSource().equals(jComboBoxAllTrack)){
tc.tadd = ItemValue.getTracksByPos(jComboBoxAllTrack.
getSelectedIndex());
try {
dp.drawAnotherTrack();
}
catch (Exception ex) {
}
}else{
if(jComboBoxT1Point.getSelectedIndex()==0){
tc.trackBegin = true;
}else{
tc.trackBegin = false;
}
if(jComboBoxT2Point.getSelectedIndex()==0){
tc.taddBegin = true;
}else{
tc.taddBegin = false;
}
try {
dp.drawBE();
}
catch (Exception ex2) {
}
}
try {
dp.repaint();
}
catch (Exception ex1) {
}
}
public void jButton1_actionPerformed(ActionEvent e) {
if ( (tc.track != null) && (tc.w1 != null) && (tc.w2 != null)) {
UniteSection us = new UniteSection();
us.setTempDoc(this.tc);
us.setTrack(tc.track, tc.tadd);
us.setOrder(tc.trackBegin, tc.taddBegin);
//us.setTracksName(this.jTextField1.getText());
us.insertIntoTempDoc();
dp.repaint();
}
}
}
class LinkPanel_jButton1_actionAdapter
implements ActionListener {
private LinkPanel adaptee;
LinkPanel_jButton1_actionAdapter(LinkPanel adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class LinkPanel_jComboBox_itemAdapter
implements ItemListener {
private LinkPanel adaptee;
LinkPanel_jComboBox_itemAdapter(LinkPanel adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.jComboBox_itemStateChanged(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -