📄 clframe.java
字号:
package net.aetherial.gis.cutAndLink;
import java.awt.*;
import javax.swing.*;
import net.aetherial.gis.surface.ItemValue;
import net.sourceforge.mlf.metouia.MetouiaLookAndFeel;
import com.borland.jbcl.layout.PaneLayout;
import com.borland.jbcl.layout.*;
import javax.swing.border.TitledBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentAdapter;
import net.aetherial.gis.our.ToMap;
import org.w3c.dom.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import net.aetherial.gis.garmin.GarminGMLDoc;
import net.aetherial.gis.cutAndLink.cut.CutToSection;
import net.aetherial.gis.surface.FrameMain;
import net.aetherial.gis.our.FrameOur;
import net.aetherial.gis.surface.editTrackPoint.NewJTable;
import net.aetherial.gis.surface.editTrackPoint.TableModel;
import net.aetherial.gis.cutAndLink.zhuanghao.DialogEnterZhuanghao;
import net.aetherial.gis.cutAndLink.resection.CurrentReverse;
import net.aetherial.gis.cutAndLink.cut.UniteAllTrack;
import net.aetherial.gis.cutAndLink.resection.DialogLinkAll;
import net.aetherial.gis.output.toLd.cut.RelateWPTAfterCut;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class CLFrame
extends JFrame {
public TempDoc tc = new TempDoc();
private Node tracks = null;
public CLFrame(Node trackNode) {
//tc.track = trackNode;
this.tracks = trackNode;
this.drawPane.setSelectTrk(trackNode);
tc.track = tc.setTrack(trackNode);
tc.setHisWpt(ItemValue.getTracksWaypoint(trackNode));
try {
jbInit();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public CLFrame() {
this(null);
}
public void setFm(FrameMain fm) {
this.fm = fm;
}
public void setFo(FrameOur fo) {
this.fo = fo;
}
private void jbInit() throws Exception {
jPanelCut = new CutPanel(this, this.tc);
this.title = this.title + " [" + ItemValue.getTracksName(tc.track) + "]";
this.jPanelCut.init();
this.jPanelLink.init();
this.jPanelCut.setDynamicPanel(this.drawPane);
this.jPanelLink.setDynamicPanel(this.drawPane);
this.initShow(this);
getContentPane().setLayout(borderLayout1);
{
model = new TableModel(tc.track);
this.table1 = new NewJTable(model, tc.track, this.drawPane);
table1.setPreferredScrollableViewportSize(new Dimension(180, 150));
this.table2 = new NewJTable(model, tc.track, this.drawPane);
table2.setPreferredScrollableViewportSize(new Dimension(180, 150));
}
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
this.addComponentListener(new CLFrame_this_componentAdapter(this));
jButtonCancel.setText("取消");
jButtonSubmit.setText("确定");
jButtonShowMap.setText("显示本航迹");
jButtonZoomIn.setText(" 放 大 ");
jButtonZoomOut.setText(" 缩 小 ");
jButtonShowAllTrack.setText("显示其他航迹");
jButtonShowAllWaypoint.setText("显示其他航点");
jB_showHisWpt.setToolTipText("显示\\隐藏该航迹包含的航点");
jB_showHisWpt.setText("显示包含的航点");
jButtonSubmit.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonCancel.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonShowMap.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonZoomIn.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonZoomOut.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonShowAllTrack.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonShowAllWaypoint.addActionListener(new CLFrame_jButton_actionAdapter(this));
jB_showHisWpt.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonSubmit.setActionCommand("Submit");
jButtonCancel.setActionCommand("Cancel");
jButtonShowMap.setActionCommand("Show_Map");
jButtonZoomIn.setActionCommand("Zoom_In");
jButtonZoomOut.setActionCommand("Zoom_Out");
jButtonShowAllTrack.setActionCommand("Show_All_Track");
jButtonShowAllWaypoint.setActionCommand("Show_All_Waypoint");
jB_showHisWpt.setActionCommand("Show_His_Waypoint");
jSplitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);
// jTextArea1.setText("");
//jPanel2.setBackground(Color.white);
jSplitPane3.setOrientation(JSplitPane.VERTICAL_SPLIT);
//jTextArea2.setText("");
jTabbedPane1.addChangeListener(new CLFrame_jTabbedPane1_changeAdapter(this));
jButtonAddZhuanghao.setText("添加桩号");
jButtonAddZhuanghao.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonReverse.setText("翻转当前航迹");
jButtonReverse.addActionListener(new CLFrame_jButton_actionAdapter(this));
jButtonUniteAll.setText("合并所有航迹");
jButtonUniteAll.addActionListener(new CLFrame_jButton_actionAdapter(this));
jToolBar1.add(jButtonShowMap);
jToolBar1.add(jB_showHisWpt);
jToolBar1.add(jButtonZoomIn);
jToolBar1.add(jButtonZoomOut);
jToolBar1.add(jButtonShowAllTrack);
jToolBar1.add(jButtonShowAllWaypoint);
jToolBar1.add(jButtonAddZhuanghao);
jToolBar1.add(jButtonReverse);
jToolBar1.add(jButtonUniteAll);
this.getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);
jPanel1.add(jButtonSubmit);
jPanel1.add(jButtonCancel);
this.getContentPane().add(jSplitPane1, java.awt.BorderLayout.CENTER);
this.getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH);
jSplitPane1.add(drawPane, JSplitPane.LEFT);
jSplitPane1.add(jTabbedPane1, JSplitPane.RIGHT);
jTabbedPane1.add(jScrollPane1, "切割航迹");
jScrollPane1.getViewport().add(jSplitPane2);
jTabbedPane1.add(jScrollPane2, "合并航迹");
jScrollPane2.getViewport().add(jSplitPane3);
jSplitPane2.add(jPanelCut, JSplitPane.TOP);
jSplitPane2.add(jScrollPane3, JSplitPane.BOTTOM);
jSplitPane2.setDividerSize(2);
jSplitPane3.setDividerSize(2);
jScrollPane3.getViewport().add(table1);
jSplitPane3.add(jPanelLink, JSplitPane.TOP);
jSplitPane3.add(jScrollPane4, JSplitPane.BOTTOM);
jScrollPane4.getViewport().add(table2);
this.setJSplitPaneDiviverToRightPlace();
this.show();
tc.resetTempDoc();
}
public void initShow(Frame f) {
f.setSize(700, 500);
f.setIconImage(ItemValue.getImage("HSDIlogo.gif"));
f.setTitle(this.title);
Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
f.setLocation(
(screenDim.width - 700) / 2,
(screenDim.height - 500) / 2
);
}
public void setJSplitPaneDiviverToRightPlace() {
this.jSplitPane1.setDividerLocation(470);
this.jSplitPane2.setDividerLocation(250);
this.jSplitPane3.setDividerLocation(230);
}
private void setShowAllButton() {
if (drawPane.getShowAllTracks()) {
this.jButtonShowAllTrack.setText("隐藏其他航迹");
}
else {
this.jButtonShowAllTrack.setText("显示其他航迹");
}
if (drawPane.getShowAllWaypoints()) {
this.jButtonShowAllWaypoint.setText("隐藏其他航点");
}
else {
this.jButtonShowAllWaypoint.setText("显示其他航点");
}
if (drawPane.getShowHisWpt()) {
this.jB_showHisWpt.setText("隐藏包含的航点");
}
else {
this.jB_showHisWpt.setText("显示包含的航点");
}
}
private void msg(String message) {
JOptionPane.showMessageDialog(this, message, "切割与合并",
JOptionPane.INFORMATION_MESSAGE);
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(new MetouiaLookAndFeel());
}
catch (Exception ex) {
}
CLFrame cl = new CLFrame();
}
public void setJTextAreaText(String s) {
// this.jTextArea1.insert(s,0);
}
/**
* 将东西都设置为空.
*/
private void setThisToNull() {
this.tc = null;
this.drawPane = null;
this.fm = null;
this.fo = null;
this.g = null;
this.tracks = null;
this.dispose();
System.gc();
}
public void frameMemoryShow() {
if (this.fm != null) {
fm.memoryShow(true, false);
}
if (this.fo != null) {
fo.memoryShow(true, false);
}
}
public void jButton_actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Submit")) {
GarminGMLDoc.IDAadd();
Node temp = tc.tempDocIntoGarminDocAfterCut(this.tracks);
// (new RelateWPTAfterCut()).relateWptToTrk(ItemValue.getWaypoint(), temp);
//this.tracks = tc.setTrack(tc.track);
if (this.model.getDataEdit()) {
tc.setNodeToGarminDoc(this.tracks, tc.track);
}
this.hide();
this.frameMemoryShow();
this.setThisToNull();
}
else if (e.getActionCommand().equals("Cancel")) {
this.hide();
this.setThisToNull();
}
else if (e.getActionCommand().equals("Show_Map")) {
drawPane.reset();
this.setShowAllButton();
}
else if (e.getActionCommand().equals("Zoom_In")) {
drawPane.zoomIn();
}
else if (e.getActionCommand().equals("Zoom_Out")) {
drawPane.zoomOut();
}
else if (e.getActionCommand().equals("Show_All_Track")) {
drawPane.setShowAllTracksToOther();
this.setShowAllButton();
drawPane.repaint();
}
else if (e.getActionCommand().equals("Show_All_Waypoint")) {
drawPane.setShowAllWaypointsToOther();
this.setShowAllButton();
drawPane.repaint();
}
else if (e.getActionCommand().equals("Show_His_Waypoint")) {
drawPane.setShowHisWpt();
this.setShowAllButton();
drawPane.repaint();
}
else if (e.getSource().equals(this.jButtonAddZhuanghao)) {
DialogEnterZhuanghao enterZhuanghao = new DialogEnterZhuanghao(this,
this.tracks, this.drawPane);
enterZhuanghao.show();
}
else if (e.getSource().equals(this.jButtonReverse)) {
CurrentReverse reverse = new CurrentReverse();
tc.track = reverse.reverse(tc.track);
this.model.setData(tc.track);
this.model.setDataEdited();
if (this.table1 != null) {
this.model.fireTableDataChanged();
this.table1.repaint();
}
if (this.table2 != null) {
this.model.fireTableDataChanged();
this.table2.repaint();
}
}
else if (e.getSource().equals(this.jButtonUniteAll)) {
UniteAllTrack unite = new UniteAllTrack();
if (!unite.isAllTrackNumberSame()) {
JOptionPane.showMessageDialog(this, "本文件所有航迹不同编号。", "合并错误",
JOptionPane.ERROR_MESSAGE);
return;
}
else {
try {
Node tempNode = unite.createLinkedTrk();
this.tc.tadded = tempNode;
ItemValue.removeTrack(tempNode);
}
catch (Exception ex) {
// JOptionPane.showMessageDialog(this, ex.getMessage(), "合并错误",
// JOptionPane.ERROR_MESSAGE);
DialogLinkAll link = new DialogLinkAll(this);
link.initToThis(unite.getConcatenatedTrack());
link.show();
return;
}
this.drawPane.repaint();
}
}
}
public void this_componentResized(ComponentEvent e) {
// System.out.println("this.jSplitPane1.getWidth():" +
// this.jSplitPane1.getWidth());
// System.out.println("this.jPanel2.getWidth():" + this.drawPane.getWidth());
if (this.jSplitPane1.getWidth() > 300) {
this.jSplitPane1.setDividerLocation(this.jSplitPane1.getWidth() - 300);
}
}
BorderLayout borderLayout1 = new BorderLayout();
public FrameMain fm = null;
private FrameOur fo = null;
private String title = "切割与合并航迹";
private Graphics g = null;
JToolBar jToolBar1 = new JToolBar();
JPanel jPanel1 = new JPanel();
JButton jButtonCancel = new JButton();
JButton jButtonSubmit = new JButton();
JSplitPane jSplitPane1 = new JSplitPane();
public DynamicPanel drawPane = new DynamicPanel(this, this.tc);
JTabbedPane jTabbedPane1 = new JTabbedPane(JTabbedPane.BOTTOM);
JScrollPane jScrollPane1 = new JScrollPane();
JScrollPane jScrollPane2 = new JScrollPane();
JSplitPane jSplitPane2 = new JSplitPane();
public CutPanel jPanelCut = new CutPanel(this, this.tc);
public LinkPanel jPanelLink = new LinkPanel(this.tc);
JScrollPane jScrollPane3 = new JScrollPane();
JScrollPane jScrollPane4 = new JScrollPane();
TableModel model = null;
NewJTable table1 = null;
NewJTable table2 = null;
//JTextArea jTextArea1 = new JTextArea();
XYLayout xYLayout1 = new XYLayout();
TitledBorder titledBorder1 = new TitledBorder("");
JSplitPane jSplitPane3 = new JSplitPane();
//JTextArea jTextArea2 = new JTextArea();
XYLayout xYLayout2 = new XYLayout();
JButton jButtonShowMap = new JButton();
JButton jButtonZoomIn = new JButton();
JButton jButtonZoomOut = new JButton();
JButton jButtonShowAllTrack = new JButton();
JButton jButtonShowAllWaypoint = new JButton();
JButton jB_showHisWpt = new JButton();
JButton jButtonAddZhuanghao = new JButton();
JButton jButtonReverse = new JButton();
JButton jButtonUniteAll = new JButton();
public void jTabbedPane1_stateChanged(ChangeEvent e) {
if (this.jTabbedPane1.getSelectedIndex() == 0) {
drawPane.setShow(true);
}
else {
drawPane.setShow(false);
}
drawPane.repaint();
//drawPane.setShow();
//System.out.println("jTabbedPane1_stateChanged"+this.jTabbedPane1.getSelectedIndex());
}
}
class CLFrame_jTabbedPane1_changeAdapter
implements ChangeListener {
private CLFrame adaptee;
CLFrame_jTabbedPane1_changeAdapter(CLFrame adaptee) {
this.adaptee = adaptee;
}
public void stateChanged(ChangeEvent e) {
adaptee.jTabbedPane1_stateChanged(e);
}
}
class CLFrame_this_componentAdapter
extends ComponentAdapter {
private CLFrame adaptee;
CLFrame_this_componentAdapter(CLFrame adaptee) {
this.adaptee = adaptee;
}
public void componentResized(ComponentEvent e) {
adaptee.this_componentResized(e);
}
}
class CLFrame_jButton_actionAdapter
implements ActionListener {
private CLFrame adaptee;
CLFrame_jButton_actionAdapter(CLFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -