xyzoutput.java

来自「基于Java的地图数据管理软件。使用MySQL数据库管理系统。」· Java 代码 · 共 66 行

JAVA
66
字号
package net.aetherial.gis.our.output.txt;

import javax.swing.*;
import java.io.File;
import net.aetherial.gis.excel.ExcelFilter;
import net.aetherial.gis.surface.ItemValue;
import org.w3c.dom.Node;
import net.aetherial.gis.dataType.ElementToWpt;
import net.aetherial.gis.surface.CreateFile;
import net.aetherial.gis.dataType.ElementToTrk;
import org.w3c.dom.NodeList;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class XYZOutput {
  public XYZOutput() {
  }

  private String scanAllPoints() {
    String pointsN = "", ln = "\r\n";

    Node[] trks = ItemValue.getTracks();
    Node[] wpts = null;
    if (trks == null) {
      return "";
    }
    NodeList nl = null;
    for (int i = 0; i < trks.length; i++) {
      pointsN = pointsN + ItemValue.getTracksName(trks[i]) + ln;
      wpts = ItemValue.getTracksWaypoint(trks[i]);
      nl = ItemValue.getTracksPoint(trks[i]);
      if (wpts != null) {
        for (int j = 0; j < wpts.length; j++) {
          pointsN = pointsN + ItemValue.getWaypointName(wpts[j]) + "," +
              ItemValue.getWaypointX(wpts[j]) + "," +
              ItemValue.getWaypointY(wpts[j]) + "," +
              ItemValue.getWaypointZ(wpts[j]) + ln;
        }
      }
      for (int j = nl.getLength() -1; j >= 0; j--) {
        pointsN = pointsN + (j + 1) + "," + ItemValue.getTracksPointX(nl.item(j)) +
            "," + ItemValue.getTracksPointY(nl.item(j)) + "," +
            ItemValue.getTracksPointZ(nl.item(j)) + ln;
      }

    }
    return pointsN;
  }

  public void output(String filepath) {
    CreateFile cfWpt = new CreateFile(new File(filepath));
    cfWpt.setEncode("GB2312");
    cfWpt.memoryToFile(this.scanAllPoints());
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?